Ejemplo n.º 1
0
        public FunkyForest(IMap map)
        {
            var mat = map.GetMapMatrice();

            forest = new ForestSquare[mat.GetLength(0), mat.GetLength(1)];
            for (int i = 0; i < mat.GetLength(0); i++)
            {
                for (int j = 0; j < mat.GetLength(1); j++)
                {
                    forest[i, j] = SomeMagic(mat[i, j]);
                }
            }
        }
Ejemplo n.º 2
0
        public PlayArea(Page pPage, int pSize)
        {
            mPage = pPage;
            Grid bottomButtons = new Grid();

            mUndoButton = new Button()
            {
                Text = "Undo Turn"
            };
            mUndoButton.Pressed += BackPressed;
            bottomButtons.Children.AddHorizontal(mUndoButton);

            Button button = new Button()
            {
                Text = "End Turn"
            };

            button.Pressed += EndTurnPressed;
            bottomButtons.Children.AddHorizontal(button);

            button = new Button()
            {
                Text = "Solve Turn"
            };
            button.Pressed += SolveTurn;;
            bottomButtons.Children.AddHorizontal(button);

            Padding             = 0;
            Margin              = 0;
            RowSpacing          = 3;
            ColumnSpacing       = 3;
            BackgroundColor     = Color.Black;
            mSize               = pSize;
            mPlayerUnits        = new List <PlayerUnit>();
            mEnemyUnits         = new List <EnemyUnit>();
            mGridBuildings      = new List <GridBuilding>();
            mHighlightedSquares = new List <Square>();
            mEmergingSquares    = new List <Square>();
            mSquares            = new Square[mSize, mSize];
            mActionStackNew     = new ActionStack(this);
            string board = "rrfmmrrr,rrrrmfrr,rffmrrrr,frrrrrrm,rrrrrrfr,rrrrrrrr,fffrrrrm,rrrrrrmm";

            string[] rows = board.Split(',');
            string   r;
            char     s;
            Square   square;

            for (int row = 0; row < mSize; ++row)
            {
                r = rows[row];
                for (int col = 0; col < mSize; ++col)
                {
                    s = r[col];
                    switch (s)
                    {
                    case 'f':
                        square = new ForestSquare(this, row, col);
                        break;

                    case 'm':
                        square = new RegularSquare(this, row, col);
                        new Mountain(square);
                        break;

                    default:
                        square = new RegularSquare(this, row, col);
                        break;
                    }

                    mSquares[row, col] = square;
                    Children.Add(square, col, row);
                }
            }
            mPlayerUnits.Add(new GravityMech(mSquares[3, 2], null));
            mPlayerUnits.Add(new SiegeMech(mSquares[4, 2], null));
            mPlayerUnits.Add(new JudoMech(mSquares[3, 4], new ChenRong()));
            mPlayerUnits.Add(new OldArtillery(mSquares[3, 3]));
            mPlayerUnits[3].Damage(1, DamageType.Direct);

            mEnemyUnits.Add(new Scorpion(mSquares[5, 2]));
            mEnemyUnits[0].Damage(1, DamageType.Direct);
            mEnemyUnits.Add(new Scorpion(mSquares[2, 5]));
            mEnemyUnits.Add(new Firefly(mSquares[5, 4]));
            mEnemyUnits.Add(new Scorpion(mSquares[3, 5]));

            mGridBuildings.Add(new GridBuilding(mSquares[1, 1], 1));
            mGridBuildings.Add(new ObjectiveGridBuilding(mSquares[1, 3], 1));
            mGridBuildings.Add(new GridBuilding(mSquares[2, 4], 1));
            mGridBuildings.Add(new GridBuilding(mSquares[2, 7], 1));
            mGridBuildings.Add(new GridBuilding(mSquares[4, 1], 2));
            mGridBuildings.Add(new GridBuilding(mSquares[4, 7], 2));
            mGridBuildings.Add(new GridBuilding(mSquares[5, 1], 2));
            mGridBuildings.Add(new GridBuilding(mSquares[5, 7], 2));

            ToggleEmerging(mSquares[5, 3]);
            ToggleEmerging(mSquares[7, 4]);

            mSquares[6, 1].ApplyStatus(SquareStatus.Fire);

            //other = new Mountain(mSquares[3, 4]);
            //other = new EnemyUnit(mSquares[4, 6], 3);
            //mEnemyUnits[1].MoveSquares().ForEach(sq => sq.BackgroundColor = Color.Red);
            //List<PlayerAttack> attacks = mPlayerUnits[3].PossibleAttacks();
            //attacks.ForEach(a => a.TargetSquare.BackgroundColor = Color.Blue);
            //attacks[0].Do(mActionStack);
            //attacks = unit.PossibleAttacks();
            //attacks[0].Do(mActionStack);
            //UndoLastAttack();
            //attacks.ForEach(a => { if (a.TargetSquare.Equals(mSquares[3, 3])) a.Do(mActionStack); });

            Children.Add(bottomButtons, 0, mSize, mSize, mSize + 1);
        }
Ejemplo n.º 3
0
 public void MoveTo(ForestSquare cell)
 {
     cell.ReactWith(this);
 }