public void MoveTowards(GridPosition target) { if (MovementLeft <= 0) { if (selection == this) selection = null; return; } var lookPos = target.GetWorldPos(); lookPos.y = transform.position.y; transform.LookAt(lookPos); path = GamePlay.Instance.grid.FindPath(Position, target); if (path.Count > 0) { if (tween != null) LeanTween.cancel(gameObject); SetUsedMovementPoint(usedMovementPoints + 1); tween = LeanTween.move(gameObject, path[0].GetWorldPos(), moveTime); tween.setEase(LeanTweenType.easeInOutQuad); Position.occupant = null; Position = path[0]; Position.occupant = gameObject; pathIndex = 0; tween.onComplete = () => { OnCompletePathStep(); } ; if (moveParticles) moveParticles.Play(); SoundManager.Instance.PlaySound(moveSound); } }