public void Update() { if (GameManager.Instance.IsGamePaused()) { return; } switch (state) { default: case State.Roaming: pathfindingMovement.MoveToTimer(roamPosition); float reachedPositionDistance = 1f; if (Vector3.Distance(transform.position, roamPosition) < reachedPositionDistance) { roamPosition = GetRoamingPosition(); } FindTarget(); break; case State.ChaseTarget: pathfindingMovement.MoveToTimer(PlayerManager.Instance.GetPlayerPosition()); if (Vector3.Distance(transform.position, PlayerManager.Instance.GetPlayerPosition()) < attackRange) { pathfindingMovement.StopMoving(); shoot.FireWeapon((PlayerManager.Instance.GetPlayerPosition() - transform.position)); } break; } }
public void FireWeapon(Vector2 d) { shoot.FireWeapon(d); lastDir = d; }