예제 #1
0
    IEnumerator Move(Vector2 direction)
    {
        int xDir = Mathf.RoundToInt(direction.x);
        int yDir = Mathf.RoundToInt(direction.y);

        if (level.IsInsideGrid(x + xDir, y + yDir))
        {
            if (level.grid[x + xDir, y + yDir].tileType != TileType.Impassable)
            {
                switch (currentEffect)
                {
                case Effect.Normal:
                    yield return(MoveTo(xDir, yDir));

                    break;

                case Effect.Slowed:
                    yield return(SpendStuckTurn());

                    break;

                case Effect.Stuck:
                    yield return(SpendStuckTurn());

                    break;

                default:
                    break;
                }
            }
        }
        actionsUI.RemoveAction();
        GameManager.Instance.SpendTurns(1);
    }