Пример #1
0
    private void GeneratePickup()
    {
        var tiles = Grid.GetTiles();

        for (int i = 0; i < PickupAmount; i++)
        {
            var tile = tiles[Random.Range(0, tiles.Count)];
            if (tile != null)
            {
                tile.SpawnPickup(Pickup);
            }
        }
    }
Пример #2
0
    public void TextureTerain(GridContainer Grid)
    {
        foreach (var tile in Grid.GetTiles())
        {
            var random = Random.Range(0, 100);
            if (random < FloorChance)
            {
                tile.gameObject.GetComponent <Renderer>().material = GrassMaterial;
            }
            else
            {
                tile.gameObject.GetComponent <Renderer>().material = GroundMaterial;
            }
        }

        foreach (var wall in Grid.GetWalls())
        {
            wall.gameObject.GetComponent <Renderer>().material = WallMaterial;
        }
    }