public static void OnPlayerInput(UnitController.eDirection direction) { if (OnPlayerInputEvent != null) { OnPlayerInputEvent(direction); } }
//Checking if Node is not null and not blocked in the direction to move, if traversable then returns the node it can move to. public Node IsTraversible(UnitController.eDirection direction) { switch (direction) { case UnitController.eDirection.UP: if (upNode != null && !upNode.IsBlocked) { return(upNode); } break; case UnitController.eDirection.DOWN: if (downNode != null && !downNode.IsBlocked) { return(downNode); } break; case UnitController.eDirection.LEFT: if (leftNode != null && !leftNode.IsBlocked) { return(leftNode); } break; case UnitController.eDirection.RIGHT: if (rightNode != null && !rightNode.IsBlocked) { return(rightNode); } break; } return(null); }
public void CreateConnection(UnitController.eDirection direction, Node node) { switch (direction) { case UnitController.eDirection.UP: upNode = node; break; case UnitController.eDirection.DOWN: downNode = node; break; case UnitController.eDirection.LEFT: leftNode = node; break; case UnitController.eDirection.RIGHT: rightNode = node; break; } }
public void ArrowPressed(int directionIndex) { UnitController.eDirection direction = (UnitController.eDirection)directionIndex; LevelManager.OnPlayerInput(direction); }
private void PlayerInput(UnitController.eDirection direction) { //On user input attempt move in the given direction. playerUnit.AttemptMove(direction); }