remove unnecessary models in animation folder

player waypoint indicator
walk and idle animations
stop when menu opens
This commit is contained in:
2022-11-16 23:17:02 +02:00
parent de20e774eb
commit b58221dc98
65 changed files with 33062 additions and 642 deletions
+28 -13
View File
@@ -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);
}
}
}