Esempio n. 1
0
 public override void transform()
 {
     if (currentHp >= maxHp)
     {
         LargeFire tmp = new LargeFire(tile, rng);
         tile.fire = tmp;
     }
     else if (currentHp <= minHp)
     {
         SmallFire tmp = new SmallFire(tile, rng);
         tmp.currentHp = tmp.maxHp;
         tile.fire     = tmp;
     }
     tile.gameBoard.main.updateTile(tile.row, tile.col);
 }
Esempio n. 2
0
 /// <summary>
 /// spread fire to neighbor tiles if possible
 /// </summary>
 public void spreadFire()
 {
     if (rng.Next(100) <= spreadChance)
     {
         if (tile.findNeighborsWithoutFire(spreadRadius) == null)
         {
             return;
         }
         Tile[] neighborsWithoutFire = tile.findNeighborsWithoutFire(spreadRadius);
         int    randomIndex          = rng.Next(tile.countNeighborsWithoutFire(spreadRadius));
         Fire   newFire = new SmallFire(neighborsWithoutFire[randomIndex], rng);
         newFire.currentHp = rng.Next(newFire.maxHp - newFire.minHp);
         neighborsWithoutFire[randomIndex].fire = newFire;
         tile.gameBoard.main.updateTile(newFire.tile.row, newFire.tile.col);
     }
 }