Esempio n. 1
0
    private bool IsTileOnFire(Vector3 position)
    {
        int layerMask = 1 << 9; // layer of map tile

        if (Physics.Raycast(position, Vector3.down, out RaycastHit hit, 3, layerMask))
        {
            TileFire tileBelow = hit.collider.gameObject.GetComponentInParent <TileFire>();
            if (tileBelow != null)   //Make sure we are above tile
            {
                if (tileBelow.IsTileOnFire())
                {
                    return(true);
                }
            }
        }
        return(false);
    }
Esempio n. 2
0
    void FixedUpdate()
    {
        fireTickCounter--;
        if (fireTickCounter <= 0)
        {
            for (int i = 0; i < mapSizeX; i++)
            {
                for (int j = 0; j < mapSizeY; j++)
                {
                    TileFire tileFire = map[i, j].GetComponent <TileFire>();
                    if (tileFire.IsTileOnFire())
                    {
                        if (i > 0)
                        {
                            TileIgnition(i - 1, j);
                        }
                        if (i < mapSizeX - 1)
                        {
                            TileIgnition(i + 1, j);
                        }
                        if (j > 0)
                        {
                            TileIgnition(i, j - 1);
                        }
                        if (j < mapSizeY - 1)
                        {
                            TileIgnition(i, j + 1);
                        }

                        tileFire.fireDuration--;
                    }
                }
                fireTickCounter = fireTickDelay;
            }
        }
    }
Esempio n. 3
0
 void Start()
 {
     tileFire = gameObject.GetComponent <TileFire>();
 }