Ejemplo n.º 1
0
    private void AddAesthetic(IWorldTile tile, int num)
    {
        for (int i = 0; i < num; i++)
        {
            while (true)
            {
                int x = Random.Range(0, generatorInstance.GetWorldSize().x);
                int y = Random.Range(0, generatorInstance.GetWorldSize().y);

                // Dont spawn on top of the player or right next to them
                if (generatorInstance.IsValidMonsterSpawn(new Vector2Int(x, y)))
                {
                    generator.SetTileAt(tile, new Vector2Int(x, y));
                    break;
                }
            }
        }
    }