public override void SetPath(PlayerMovementFSM pc, Vector2 startIndex, Vector2 endIndex) { if (pc.currentPath != null) { if (pc.currentPath.Destination.Index == endIndex) { pc.TransitionToState(pc.moving); } else { pc.ChangePath(GameManager.Instance.fieldScript.GetPath(startIndex.ToInt2(), endIndex.ToInt2())); } } else { pc.ChangePath(GameManager.Instance.fieldScript.GetPath(startIndex.ToInt2(), endIndex.ToInt2())); } }
private void GoToNextTile(PlayerMovementFSM pc) { if (MoveToTile(currentPath.CurrentTile, pc.playerTransform)) { if (currentPath.CurrentTile == currentPath.Destination) { pc.EndPath(currentPath); pc.TransitionToState(pc.idle); } else if (movementPaused) { pc.TransitionToState(pc.paused); pc.ChangePath(null); } else { currentPath.NextPosition(); pc.ChangePath(null); } } }