public override void ProcessInput(PlayerMovementFSM pc, PlayerMovementFSM.Inputs input) { Debug.Log("Paused"); if (input == PlayerMovementFSM.Inputs.SpaceBar) { pc.TransitionToState(pc.moving); return; } if (input == PlayerMovementFSM.Inputs.RightMouseClick) { pc.TransitionToState(pc.idle); return; } if (input == PlayerMovementFSM.Inputs.LeftMouseClick) { return; } }
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); } } }
public override void ProcessInput(PlayerMovementFSM pc, PlayerMovementFSM.Inputs input) { if (input == PlayerMovementFSM.Inputs.RightMouseClick) { pc.ClearPath(); } if (pc.currentPath != null) { pc.TransitionToState(pc.moving); } if (input == PlayerMovementFSM.Inputs.LeftMouseClick) { pc.currentPath = GameManager.Instance.fieldScript.GetPath(TileField.IndexOfPosition(pc.playerTransform.position, EditorManager.Instance.gameSettings.tileWidth, EditorManager.Instance.gameSettings.tileHeight), TileField.IndexOfPosition(Camera.main.ScreenToWorldPoint(Input.mousePosition), EditorManager.Instance.gameSettings.tileWidth, EditorManager.Instance.gameSettings.tileHeight)); } }
public override void SetPath(PlayerMovementFSM pc, Vector2 startIndex, Vector2 endIndex) { if (pc.currentPath.Destination.Index == endIndex) { pc.TransitionToState(pc.moving); } else { Path newPausedPath = GameManager.Instance.fieldScript.GetPath(startIndex.ToInt2(), endIndex.ToInt2()); if (newPausedPath == null) { return; } pc.ChangePath(newPausedPath); } }