Exemplo n.º 1
0
 public void Update()
 {
     //If Tile is heated it heats surrounding Tiles
     if (heated)
     {
         for (int x = -1; x <= 1; x++)
         {
             for (int y = -1; y <= 1; y++)
             {
                 Vector3Int position = new Vector3Int(Mathf.RoundToInt(transform.position.x) + x,
                                                      Mathf.RoundToInt(transform.position.y + y), 0);
                 HeatableTile temp = Level.instance.GetHeatableTile(position);
                 if (temp != null && !temp.heated && Level.instance.IgniteNeighbourTilePercent >= Random.value)
                 {
                     temp.HeatUp();
                 }
             }
         }
     }
     else if (ticks > ticksToHeatAgain)
     {
         sr.sprite = sprites[0];
     }
     else
     {
         ticks++;
     }
 }
Exemplo n.º 2
0
 void Start()
 {
     array = new HeatableTile[sizeX, sizeY];
     foreach (Transform child in tileContainer.transform)
     {
         int childX, childY;
         childX = Mathf.RoundToInt(child.position.x);
         childY = Mathf.RoundToInt(child.position.y);
         if (childX <= sizeX && childY <= sizeY)
         {
             if (array[childX, childY] != null)
             {
                 continue;
             }
             HeatableTile temp = child.GetComponent <HeatableTile>();
             if (temp != null)
             {
                 array[childX, childY] = temp;
             }
         }
     }
 }