示例#1
0
 public ActionStack(PlayArea pPlayArea)
 {
     mPlayArea        = pPlayArea;
     EnemyAttackIndex = 0;
     mNextId          = 1;
     mStack           = new Stack <GameAction>();
     mEnemyAttacks    = new List <EnemyAttack>();
 }
        public BoardState(PlayArea pPlayArea)
        {
            mPlayArea       = pPlayArea;
            mBuildingDamage = mPlayArea.GetGridBuildingDamage();
            mPlayerDamage   = mPlayArea.GetPlayerDamage();
            mEnemyDamage    = mPlayArea.GetEnemyDamage();
            mEnemyCount     = mPlayArea.GetEnemyCount();

            mPlayerHasAttacks = mPlayArea.GetPlayerHasAttacks();
            mPlayerHasMoves   = mPlayArea.GetPlayerHasMoves();
        }
        public MainPage()
        {
            InitializeComponent();

            Content = new PlayArea(this, 8);
        }
示例#4
0
        public static Square GetSquareFrom(Square pSquare, Direction pDirection, int pDistance = 1)
        {
            PlayArea playArea = pSquare.PlayArea;
            int      size     = playArea.Size;
            int      row      = pSquare.Row;
            int      col      = pSquare.Column;

            if (pDistance == -1)
            {
                if (GetSquareFrom(pSquare, pDirection) == null)
                {
                    return(null);
                }
                Square square = pSquare;
                do
                {
                    if (GetSquareFrom(square, pDirection) == null)
                    {
                        break;
                    }
                    square = GetSquareFrom(square, pDirection);
                } while (square != null && square.Unit == null);
                return(square);
            }

            switch (pDirection)
            {
            case Direction.North:
                row -= pDistance;
                if (row < 0)
                {
                    return(null);
                }
                break;

            case Direction.East:
                col += pDistance;
                if (col >= size)
                {
                    return(null);
                }
                break;

            case Direction.South:
                row += pDistance;
                if (row >= size)
                {
                    return(null);
                }
                break;

            case Direction.West:
                col -= pDistance;
                if (col < 0)
                {
                    return(null);
                }
                break;

            default:
                break;
            }

            return(playArea.Squares[row, col]);
        }