Ejemplo n.º 1
0
 public static void OnPlayerInput(UnitController.eDirection direction)
 {
     if (OnPlayerInputEvent != null)
     {
         OnPlayerInputEvent(direction);
     }
 }
Ejemplo n.º 2
0
    //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);
    }
Ejemplo n.º 3
0
    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;
        }
    }
Ejemplo n.º 4
0
 public void ArrowPressed(int directionIndex)
 {
     UnitController.eDirection direction = (UnitController.eDirection)directionIndex;
     LevelManager.OnPlayerInput(direction);
 }
Ejemplo n.º 5
0
 private void PlayerInput(UnitController.eDirection direction)
 {
     //On user input attempt move in the given direction.
     playerUnit.AttemptMove(direction);
 }