public bool isBurning(Building building) { foreach(FlammableSquare Square in this.squaresOccupied) { if (Square.currentTokens > 0) { return true; } } return false; }
public void SpreadFireOnLargeBuilding(Building building) { if (building.isBurning(building) == true) { foreach (FlammableSquare Square in building.squaresOccupied) { if (Square.currentTokens == 0) { Square.Ignite(); } } } }
private void ConstructSquares(string blockName) { //The CBs will have temporary names. When they actually get placed onto the board, they'll be given their proper Square names. try { switch (blockName) { case "Claw": { Square CBA1 = new Square("CBA1", Resources.ClawA1); Square CBA2 = new Square("CBA2", Resources.ClawA2); Square CBA3 = new Square("CBA3", Resources.ClawA3); Square CBA4 = new Square("CBA4", Resources.ClawA4, 2.5, 2.5, false); this.RowCBA.InsertRange(RowCBA.Count, new Square[] { CBA1, CBA2, CBA3, CBA4 }); FlammableSquare CBB1 = new FlammableSquare("CBB1", Resources.ClawB1, 2); FlammableSquare CBB2 = new FlammableSquare("CBB2", Resources.ClawB2, 3); FlammableSquare CBB3 = new FlammableSquare("CBB3", Resources.ClawB3, 3); Square CBB4 = new Square("CBB4", Resources.ClawB4); this.RowCBB.InsertRange(RowCBB.Count, new ISquareTypes[] { CBB1, CBB2, CBB3, CBB4 }); Square CBC1 = new Square("CBC1", Resources.ClawC1); FlammableSquare CBC2 = new FlammableSquare("CBC2", Resources.ClawC2, 4); FlammableSquare CBC3 = new FlammableSquare("CBC3", Resources.ClawC3, 4); Square CBC4 = new Square("CBC4", Resources.ClawC4); this.RowCBC.InsertRange(RowCBC.Count, new ISquareTypes[] { CBC1, CBC2, CBC3, CBC4 }); FlammableSquare CBD1 = new FlammableSquare("CBD1", Resources.ClawD1, 2); FlammableSquare CBD2 = new FlammableSquare("CBD2", Resources.ClawD2, 3); FlammableSquare CBD3 = new FlammableSquare("CBD3", Resources.ClawD3, 3); Square CBD4 = new Square("CBD4", Resources.ClawD4, 2.5, 2.5, false); this.RowCBD.InsertRange(RowCBD.Count, new ISquareTypes[] { CBD1, CBD2, CBD3, CBD4 }); this.RandomizerSquares.InsertRange(this.RandomizerSquares.Count, new FlammableSquare[] { CBB1, CBB2, CBB3, CBC2, CBC3, CBD1, CBD2, CBD3 }); //Create large buildings. List<FlammableSquare> ClawLB1Squares = new List<FlammableSquare>(); ClawLB1Squares.Add(CBB1); ClawLB1Squares.Add(CBB2); Building ClawLB1 = new Building(2, ClawLB1Squares); List<FlammableSquare> ClawLB2Squares = new List<FlammableSquare>(); ClawLB2Squares.Add(CBD1); ClawLB2Squares.Add(CBD2); Building ClawLB2 = new Building(2, ClawLB2Squares); this.LargeBuildings.Add(ClawLB1); this.LargeBuildings.Add(ClawLB2); break; } case "Donut": { Square CBA1 = new Square("CBA1", Resources.DonutA1, 2.5, 2.5, false); FlammableSquare CBA2 = new FlammableSquare("CBA2", Resources.DonutA2, 4); FlammableSquare CBA3 = new FlammableSquare("CBA3", Resources.DonutA3, 3); FlammableSquare CBA4 = new FlammableSquare("CBA4", Resources.DonutA4, 2); this.RowCBA.InsertRange(RowCBA.Count, new ISquareTypes[] { CBA1, CBA2, CBA3, CBA4 }); Square CBB1 = new Square("CBB1", Resources.DonutB1); FlammableSquare CBB2 = new FlammableSquare("CBB2", Resources.DonutB2, 3); Square CBB3 = new Square("CBB3", Resources.DonutB3); FlammableSquare CBB4 = new FlammableSquare("CBB4", Resources.DonutB4, 3); this.RowCBB.InsertRange(RowCBB.Count, new ISquareTypes[] { CBB1, CBB2, CBB3, CBB4 }); Square CBC1 = new Square("CBC1", Resources.DonutC1); FlammableSquare CBC2 = new FlammableSquare("CBC2", Resources.DonutC2, 2); FlammableSquare CBC3 = new FlammableSquare("CBC3", Resources.DonutC3, 3); FlammableSquare CBC4 = new FlammableSquare("CBC4", Resources.DonutC4, 4); this.RowCBC.InsertRange(RowCBC.Count, new ISquareTypes[] { CBC1, CBC2, CBC3, CBC4 }); Square CBD1 = new Square("CBD1", Resources.DonutD1); Square CBD2 = new Square("CBD2", Resources.DonutD2); Square CBD3 = new Square("CBD3", Resources.DonutD3); Square CBD4 = new Square("CBD4", Resources.DonutD4, 2.5, 2.5, false); this.RowCBD.InsertRange(RowCBD.Count, new ISquareTypes[] { CBD1, CBD2, CBD3, CBD4 }); this.RandomizerSquares.InsertRange(this.RandomizerSquares.Count, new FlammableSquare[] { CBA2, CBA3, CBA4, CBB2, CBB4, CBC2, CBC3, CBC4 }); //Create large buildings. List<FlammableSquare> DonutLB1Squares = new List<FlammableSquare>(); DonutLB1Squares.Add(CBA2); DonutLB1Squares.Add(CBA3); Building DonutLB1 = new Building(2, DonutLB1Squares); List<FlammableSquare> DonutLB2Squares = new List<FlammableSquare>(); DonutLB2Squares.Add(CBC3); DonutLB2Squares.Add(CBC4); Building DonutLB2 = new Building(2, DonutLB2Squares); this.LargeBuildings.Add(DonutLB1); this.LargeBuildings.Add(DonutLB2); break; } case "Easy Board 1": { FlammableSquare CBA1 = new FlammableSquare("CBA1", Resources.EasyBoard1A1, 3); FlammableSquare CBA2 = new FlammableSquare("CBA2", Resources.EasyBoard1A2, 4); FlammableSquare CBA3 = new FlammableSquare("CBA3", Resources.EasyBoard1A3, 3); Square CBA4 = new Square("CBA4", Resources.EasyBoard1A4, 2.5, 2.5, false); this.RowCBA.InsertRange(RowCBA.Count, new ISquareTypes[] { CBA1, CBA2, CBA3, CBA4 }); FlammableSquare CBB1 = new FlammableSquare("CBB1", Resources.EasyBoard1B1, 2); Square CBB2 = new Square("CBB2", Resources.EasyBoard1B2); FlammableSquare CBB3 = new FlammableSquare("CBB3", Resources.EasyBoard1B3, 4); Square CBB4 = new Square("CBB4", Resources.EasyBoard1B4); this.RowCBB.InsertRange(RowCBB.Count, new ISquareTypes[] { CBB1, CBB2, CBB3, CBB4 }); Square CBC1 = new Square("CBC1", Resources.EasyBoard1C1); Square CBC2 = new Square("CBC2", Resources.EasyBoard1C2); FlammableSquare CBC3 = new FlammableSquare("CBC3", Resources.EasyBoard1C3, 3); FlammableSquare CBC4 = new FlammableSquare("CBC4", Resources.EasyBoard1C4, 3); this.RowCBC.InsertRange(RowCBC.Count, new ISquareTypes[] { CBC1, CBC2, CBC3, CBC4 }); Square CBD1 = new Square("CBD1", Resources.EasyBoard1D1, 2.5, 2.5, false); Square CBD2 = new Square("CBD2", Resources.EasyBoard1D2); Square CBD3 = new Square("CBD3", Resources.EasyBoard1D3); FlammableSquare CBD4 = new FlammableSquare("CBD4", Resources.EasyBoard1D4, 2); this.RowCBD.InsertRange(RowCBD.Count, new ISquareTypes[] { CBD1, CBD2, CBD3, CBD4 }); this.RandomizerSquares.InsertRange(this.RandomizerSquares.Count, new FlammableSquare[] { CBA1, CBA2, CBA3, CBB1, CBB3, CBC3, CBC4, CBD4 }); //Create large buildings. List<FlammableSquare> EasyBoard1LB1Squares = new List<FlammableSquare>(); EasyBoard1LB1Squares.Add(CBA1); EasyBoard1LB1Squares.Add(CBB1); Building EasyBoard1LB1 = new Building(2, EasyBoard1LB1Squares); List<FlammableSquare> EasyBoard1LB2Squares = new List<FlammableSquare>(); EasyBoard1LB2Squares.Add(CBC4); EasyBoard1LB2Squares.Add(CBD4); Building EasyBoard1LB2 = new Building(2, EasyBoard1LB2Squares); this.LargeBuildings.Add(EasyBoard1LB1); this.LargeBuildings.Add(EasyBoard1LB2); break; } case "Easy Board 2": { FlammableSquare CBA1 = new FlammableSquare("CBA1", Resources.EasyBoard2A1, 2); FlammableSquare CBA2 = new FlammableSquare("CBA2", Resources.EasyBoard2A2, 3); Square CBA3 = new Square("CBA3", Resources.EasyBoard2A3); Square CBA4 = new Square("CBA4", Resources.EasyBoard2A4, 2.5, 2.5, false); this.RowCBA.InsertRange(RowCBA.Count, new ISquareTypes[] { CBA1, CBA2, CBA3, CBA4 }); Square CBB1 = new Square("CBB1", Resources.EasyBoard2B1); FlammableSquare CBB2 = new FlammableSquare("CBB2", Resources.EasyBoard2B2, 4); FlammableSquare CBB3 = new FlammableSquare("CBB3", Resources.EasyBoard2B3, 4); Square CBB4 = new Square("CBB4", Resources.EasyBoard2B4); this.RowCBB.InsertRange(RowCBB.Count, new ISquareTypes[] { CBB1, CBB2, CBB3, CBB4 }); Square CBC1 = new Square("CBC1", Resources.EasyBoard2C1); Square CBC2 = new Square("CBC2", Resources.EasyBoard2C2); FlammableSquare CBC3 = new FlammableSquare("CBC3", Resources.EasyBoard2C3, 4); Square CBC4 = new Square("CBC4", Resources.EasyBoard2C4); this.RowCBC.InsertRange(RowCBC.Count, new ISquareTypes[] { CBC1, CBC2, CBC3, CBC4 }); Square CBD1 = new Square("CBD1", Resources.EasyBoard2D1, 2.5, 2.5, false); FlammableSquare CBD2 = new FlammableSquare("CBD2", Resources.EasyBoard2D2, 2); FlammableSquare CBD3 = new FlammableSquare("CBD3", Resources.EasyBoard2D3, 3); FlammableSquare CBD4 = new FlammableSquare("CBD4", Resources.EasyBoard2D4, 2); this.RowCBD.InsertRange(RowCBD.Count, new ISquareTypes[] { CBD1, CBD2, CBD3, CBD4 }); this.RandomizerSquares.InsertRange(this.RandomizerSquares.Count, new FlammableSquare[] { CBA1, CBA2, CBB2, CBB3, CBC3, CBD2, CBD3, CBD4 }); //Create large buildings. List<FlammableSquare> EasyBoard2LB1Squares = new List<FlammableSquare>(); EasyBoard2LB1Squares.Add(CBA1); EasyBoard2LB1Squares.Add(CBA2); Building EasyBoard2LB1 = new Building(2, EasyBoard2LB1Squares); List<FlammableSquare> EasyBoard2LB2Squares = new List<FlammableSquare>(); EasyBoard2LB2Squares.Add(CBD2); EasyBoard2LB2Squares.Add(CBD3); EasyBoard2LB2Squares.Add(CBD4); Building EasyBoard2LB2 = new Building(3, EasyBoard2LB2Squares); this.LargeBuildings.Add(EasyBoard2LB1); this.LargeBuildings.Add(EasyBoard2LB2); break; } case "Funky": { FlammableSquare CBA1 = new FlammableSquare("CBA1", Resources.FunkyA1, 3); FlammableSquare CBA2 = new FlammableSquare("CBA2", Resources.FunkyA2, 3); Square CBA3 = new Square("CBA3", Resources.FunkyA3); Square CBA4 = new Square("CBA4", Resources.FunkyA4); this.RowCBA.InsertRange(RowCBA.Count, new ISquareTypes[] { CBA1, CBA2, CBA3, CBA4 }); FlammableSquare CBB1 = new FlammableSquare("CBB1", Resources.FunkyB1, 3); FlammableSquare CBB2 = new FlammableSquare("CBB2", Resources.FunkyB2, 3); FlammableSquare CBB3 = new FlammableSquare("CBB3", Resources.FunkyB3, 4); FlammableSquare CBB4 = new FlammableSquare("CBB4", Resources.FunkyB4, 3); this.RowCBB.InsertRange(RowCBB.Count, new ISquareTypes[] { CBB1, CBB2, CBB3, CBB4 }); FlammableSquare CBC1 = new FlammableSquare("CBC1", Resources.FunkyC1, 2); Square CBC2 = new Square("CBC2", Resources.FunkyC2); FlammableSquare CBC3 = new FlammableSquare("CBC3", Resources.FunkyC3, 4); Square CBC4 = new Square("CBC4", Resources.FunkyC4); this.RowCBC.InsertRange(RowCBC.Count, new ISquareTypes[] { CBC1, CBC2, CBC3, CBC4 }); Square CBD1 = new Square("CBD1", Resources.FunkyD1, 2.5, 2.5, false); Square CBD2 = new Square("CBD2", Resources.FunkyD2); Square CBD3 = new Square("CBD3", Resources.FunkyD3); Square CBD4 = new Square("CBD4", Resources.FunkyD4, 2.5, 2.5, false); this.RowCBD.InsertRange(RowCBD.Count, new ISquareTypes[] { CBD1, CBD2, CBD3, CBD4 }); this.RandomizerSquares.InsertRange(this.RandomizerSquares.Count, new FlammableSquare[] { CBA1, CBA2, CBB1, CBB2, CBB3, CBB4, CBC1, CBC3 }); //Create large buildings. List<FlammableSquare> FunkyLB1Squares = new List<FlammableSquare>(); FunkyLB1Squares.Add(CBB1); FunkyLB1Squares.Add(CBC1); Building FunkyLB1 = new Building(2, FunkyLB1Squares); List<FlammableSquare> FunkyLB2Squares = new List<FlammableSquare>(); FunkyLB2Squares.Add(CBB3); FunkyLB2Squares.Add(CBB4); FunkyLB2Squares.Add(CBC3); Building FunkyLB2 = new Building(3, FunkyLB2Squares); this.LargeBuildings.Add(FunkyLB1); this.LargeBuildings.Add(FunkyLB2); break; } case "L Shaped": { FlammableSquare CBA1 = new FlammableSquare("CBA1", Resources.L_ShapedA1, 2); Square CBA2 = new Square("CBA2", Resources.L_ShapedA2); Square CBA3 = new Square("CBA3", Resources.L_ShapedA3, 2.5, 2.5, false); Square CBA4 = new Square("CBA4", Resources.L_ShapedA4); this.RowCBA.InsertRange(RowCBA.Count, new ISquareTypes[] { CBA1, CBA2, CBA3, CBA4 }); FlammableSquare CBB1 = new FlammableSquare("CBB1", Resources.L_ShapedB1, 4); FlammableSquare CBB2 = new FlammableSquare("CBB2", Resources.L_ShapedB2, 3); Square CBB3 = new Square("CBB3", Resources.L_ShapedB3); Square CBB4 = new Square("CBB4", Resources.L_ShapedB4); this.RowCBB.InsertRange(RowCBB.Count, new ISquareTypes[] { CBB1, CBB2, CBB3, CBB4 }); FlammableSquare CBC1 = new FlammableSquare("CBC1", Resources.L_ShapedC1, 3); FlammableSquare CBC2 = new FlammableSquare("CBC2", Resources.L_ShapedC2, 3); Square CBC3 = new Square("CBC3", Resources.L_ShapedC3); Square CBC4 = new Square("CBC4", Resources.L_ShapedC4); this.RowCBC.InsertRange(RowCBC.Count, new ISquareTypes[] { CBC1, CBC2, CBC3, CBC4 }); FlammableSquare CBD1 = new FlammableSquare("CBD1", Resources.L_ShapedD1, 3); FlammableSquare CBD2 = new FlammableSquare("CBD2", Resources.L_ShapedD2, 4); FlammableSquare CBD3 = new FlammableSquare("CBD3", Resources.L_ShapedD3, 2); Square CBD4 = new Square("CBD4", Resources.L_ShapedD4, 2.5, 2.5, false); this.RowCBD.InsertRange(RowCBD.Count, new ISquareTypes[] { CBD1, CBD2, CBD3, CBD4 }); this.RandomizerSquares.InsertRange(this.RandomizerSquares.Count, new FlammableSquare[] { CBA1, CBB1, CBB2, CBC1, CBC2, CBD1, CBD2, CBD3 }); //Create large buildings. List<FlammableSquare> LShapedLB1Squares = new List<FlammableSquare>(); LShapedLB1Squares.Add(CBA1); LShapedLB1Squares.Add(CBB1); Building LShapedLB1 = new Building(2, LShapedLB1Squares); List<FlammableSquare> LShapedLB2Squares = new List<FlammableSquare>(); LShapedLB2Squares.Add(CBD2); LShapedLB2Squares.Add(CBD3); Building LShapedLB2 = new Building(2, LShapedLB2Squares); this.LargeBuildings.Add(LShapedLB1); this.LargeBuildings.Add(LShapedLB2); break; } case "Monster": { Square CBA1 = new Square("CBA1", Resources.MonsterA1, 2.5, 2.5, false); FlammableSquare CBA2 = new FlammableSquare("CBA2", Resources.MonsterA2, 3); FlammableSquare CBA3 = new FlammableSquare("CBA3", Resources.MonsterA3, 3); Square CBA4 = new Square("CBA4", Resources.MonsterA4); this.RowCBA.InsertRange(RowCBA.Count, new ISquareTypes[] { CBA1, CBA2, CBA3, CBA4 }); Square CBB1 = new Square("CBB1", Resources.MonsterB1); FlammableSquare CBB2 = new FlammableSquare("CBB2", Resources.MonsterB2, 3); FlammableSquare CBB3 = new FlammableSquare("CBB3", Resources.MonsterB3, 3); Square CBB4 = new Square("CBB4", Resources.MonsterB4); this.RowCBB.InsertRange(RowCBB.Count, new ISquareTypes[] { CBB1, CBB2, CBB3, CBB4 }); Square CBC1 = new Square("CBC1", Resources.MonsterC1); Square CBC2 = new Square("CBC2", Resources.MonsterC2); FlammableSquare CBC3 = new FlammableSquare("CBC3", Resources.MonsterC3, 3); FlammableSquare CBC4 = new FlammableSquare("CBC4", Resources.MonsterC4, 3); this.RowCBC.InsertRange(RowCBC.Count, new ISquareTypes[] { CBC1, CBC2, CBC3, CBC4 }); Square CBD1 = new Square("CBD1", Resources.MonsterD1, 2.5, 2.5, false); Square CBD2 = new Square("CBD2", Resources.MonsterD2); FlammableSquare CBD3 = new FlammableSquare("CBD3", Resources.MonsterD3, 3); FlammableSquare CBD4 = new FlammableSquare("CBD4", Resources.MonsterD4, 3); this.RowCBD.InsertRange(RowCBD.Count, new ISquareTypes[] { CBD1, CBD2, CBD3, CBD4 }); this.RandomizerSquares.InsertRange(this.RandomizerSquares.Count, new FlammableSquare[] { CBA2, CBA3, CBB2, CBB3, CBC3, CBC4, CBD3, CBD4 }); //Create large buildings. List<FlammableSquare> MonsterLB1Squares = new List<FlammableSquare>(); MonsterLB1Squares.Add(CBB3); MonsterLB1Squares.Add(CBC3); Building MonsterLB1 = new Building(2, MonsterLB1Squares); this.LargeBuildings.Add(MonsterLB1); break; } case "Up In Flames": { Square CBA1 = new Square("CBA1", Resources.UpInFlamesA1, 2.5, 2.5, false); Square CBA2 = new Square("CBA2", Resources.UpInFlamesA2); FlammableSquare CBA3 = new FlammableSquare("CBA3", Resources.UpInFlamesA3, 2); Square CBA4 = new Square("CBA4", Resources.UpInFlamesA4); this.RowCBA.InsertRange(RowCBA.Count, new ISquareTypes[] { CBA1, CBA2, CBA3, CBA4 }); Square CBB1 = new Square("CBB1", Resources.UpInFlamesB1); FlammableSquare CBB2 = new FlammableSquare("CBB2", Resources.UpInFlamesB2, 3); FlammableSquare CBB3 = new FlammableSquare("CBB3", Resources.UpInFlamesB3, 4); FlammableSquare CBB4 = new FlammableSquare("CBB4", Resources.UpInFlamesB4, 3); this.RowCBB.InsertRange(RowCBB.Count, new ISquareTypes[] { CBB1, CBB2, CBB3, CBB4 }); Square CBC1 = new Square("CBC1", Resources.UpInFlamesC1); FlammableSquare CBC2 = new FlammableSquare("CBC2", Resources.UpInFlamesC2, 3); FlammableSquare CBC3 = new FlammableSquare("CBC3", Resources.UpInFlamesC3, 4); FlammableSquare CBC4 = new FlammableSquare("CBC4", Resources.UpInFlamesC4, 3); this.RowCBC.InsertRange(RowCBC.Count, new ISquareTypes[] { CBC1, CBC2, CBC3, CBC4 }); Square CBD1 = new Square("CBD1", Resources.UpInFlamesD1, 2.5, 2.5, false); Square CBD2 = new Square("CBD2", Resources.UpInFlamesD2); FlammableSquare CBD3 = new FlammableSquare("CBD3", Resources.UpInFlamesD3, 2); Square CBD4 = new Square("CBD4", Resources.UpInFlamesD4); this.RowCBD.InsertRange(RowCBD.Count, new ISquareTypes[] { CBD1, CBD2, CBD3, CBD4 }); this.RandomizerSquares.InsertRange(this.RandomizerSquares.Count, new FlammableSquare[] { CBA3, CBB2, CBB3, CBB4, CBC2, CBC3, CBC4, CBD3 }); //Create large buildings. List<FlammableSquare> UIFLB1Squares = new List<FlammableSquare>(); UIFLB1Squares.Add(CBA3); UIFLB1Squares.Add(CBB3); Building UIFLB1 = new Building(2, UIFLB1Squares); List<FlammableSquare> UIFLB2Squares = new List<FlammableSquare>(); UIFLB2Squares.Add(CBC3); UIFLB2Squares.Add(CBD3); Building UIFLB2 = new Building(2, UIFLB2Squares); this.LargeBuildings.Add(UIFLB1); this.LargeBuildings.Add(UIFLB2); break; } } } catch(Exception e) { MessageBox.Show(e.ToString()); } }