private static void Move(Unit unit) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); Physics.Raycast(ray, out RaycastHit hit, 100); unit.AiPath.destination = hit.point; UnitAnimator.Move(unit.Animator); unit.UnitState = Constants.UnitState.Moving; Debug.Log("Move"); }
void Update() { if (Input.GetMouseButtonDown(Constants.RightMouseButton)) { Move(this); } if (AiPath.remainingDistance < 2f && UnitState != Constants.UnitState.Idle) { UnitAnimator.Idle(Animator); UnitState = Constants.UnitState.Idle; Debug.Log("Stop"); } if (AiPath.remainingDistance >= 2f && UnitState != Constants.UnitState.Moving) { UnitAnimator.Move(Animator); UnitState = Constants.UnitState.Moving; Debug.Log("Moving"); } }