remove unnecessary models in animation folder
player waypoint indicator walk and idle animations stop when menu opens
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerFollow : MonoBehaviour
|
||||
public class CameraPlayerFollow : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private Transform _playerTransform;
|
||||
@@ -1,32 +1,47 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AI;
|
||||
|
||||
public class CharacterMovement : MonoBehaviour
|
||||
{
|
||||
public NavMeshAgent playerNavMeshAgent;
|
||||
|
||||
public NavMeshAgent player;
|
||||
public Animator playerAnimator;
|
||||
public Camera playerCamera;
|
||||
public ParticleSystem targetDest;
|
||||
public bool allowMovement=true;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
allowMovement = true;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if(Input.GetMouseButton(0))
|
||||
if (allowMovement)
|
||||
{
|
||||
Ray myRay=playerCamera.ScreenPointToRay(Input.mousePosition);
|
||||
RaycastHit hit;
|
||||
|
||||
if(Physics.Raycast(myRay, out hit))
|
||||
if (Input.GetMouseButton(0))
|
||||
{
|
||||
playerNavMeshAgent.SetDestination(hit.point);
|
||||
Ray myRay = playerCamera.ScreenPointToRay(Input.mousePosition);
|
||||
|
||||
if (Physics.Raycast(myRay, out RaycastHit hit))
|
||||
{
|
||||
targetDest.transform.position = hit.point;
|
||||
targetDest.Play();
|
||||
player.SetDestination(hit.point);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SetDestination(player.transform.position);
|
||||
player.velocity=Vector3.zero;
|
||||
}
|
||||
if(player.velocity!=Vector3.zero)
|
||||
{
|
||||
playerAnimator.SetBool("IsWalking",true);
|
||||
}
|
||||
else if (player.velocity == Vector3.zero)
|
||||
{
|
||||
playerAnimator.SetBool("IsWalking", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using static UnityEditor.Experimental.GraphView.GraphView;
|
||||
|
||||
public class ConversationController : MonoBehaviour
|
||||
{
|
||||
@@ -13,6 +14,9 @@ public class ConversationController : MonoBehaviour
|
||||
public Button _choiceButton;
|
||||
[SerializeField]
|
||||
private Button _closeBtn;
|
||||
|
||||
[SerializeField]
|
||||
CharacterMovement _player;
|
||||
|
||||
public ConversationChangeEvent conversationChangeEvent;
|
||||
private List<ChoiceController> choiceControllers = new();
|
||||
@@ -24,6 +28,7 @@ public class ConversationController : MonoBehaviour
|
||||
|
||||
public void Change(string title, Dictionary<string, BaseAction> options)
|
||||
{
|
||||
_player.allowMovement = false;
|
||||
RemoveChoices();
|
||||
_title.text = title;
|
||||
gameObject.SetActive(true);
|
||||
@@ -50,8 +55,10 @@ public class ConversationController : MonoBehaviour
|
||||
}
|
||||
public void Hide()
|
||||
{
|
||||
|
||||
RemoveChoices();
|
||||
gameObject.SetActive(false);
|
||||
Time.timeScale = 1;
|
||||
_player.allowMovement = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user