예제 #1
0
    public TerrainType(TerrainStaticData data)
    {
        gameplayData = data;

        this.prefabs = new TerrainPrefabs(gameplayData.name);
        TypeContainer <TerrainType> .add(this.gameplayData.name, this);
    }
예제 #2
0
    // Start is called before the first frame update
    void Start()
    {
        prefabs = this.GetComponent <TerrainPrefabs>();

        for (int i = -3; i < 4; i++)
        {
            for (int j = -3; j < 4; j++)
            {
                Debug.Log("i: " + i + " j: " + j);

                if (i == 0 && j == 0)
                {
                    Instantiate(prefabs.main_tile, new Vector3(0, 0, 0), Quaternion.identity);
                }
                else
                {
                    Instantiate(prefabs.tree_tile, new Vector3(i, 0, j), Quaternion.identity);
                }
            }
        }

        // for(int i = -1; i > -5; i--){
        //     for(int j = 0; j > -5; j--){
        //         Instantiate(prefabs.tree_tile, new Vector3(i, 0, j), Quaternion.identity);
        //     }
        // }
    }
예제 #3
0
    /// <summary>
    /// Destructor for TerrainPrefabs
    /// </summary>
    /// <param name="terrainPrefabs"></param>
    public static void Destroy(TerrainPrefabs terrainPrefabs)
    {
        GameObject.Destroy(terrainPrefabs.block);
        foreach (GameObject wall in terrainPrefabs.walls)
        {
            GameObject.Destroy(wall);
        }

        terrainPrefabs = null;
    }
예제 #4
0
    public TerrainType(TerrainStaticData data, TerrainPrefabs prefabs)
    {
        gameplayData = data;

        if (prefabs == null)
        {
            this.prefabs = new TerrainPrefabs(gameplayData.name);
        }

        TypeContainer <TerrainType> .add(gameplayData.name, this);
    }
예제 #5
0
    public TerrainType(TerrainStaticData data, TerrainPrefabs prefabs)
    {
        gameplayData = data;

        if (prefabs == null)
            this.prefabs = new TerrainPrefabs( gameplayData.name );

        TypeContainer<TerrainType>.add( gameplayData.name, this );
    }
예제 #6
0
    public TerrainType(TerrainStaticData data)
    {
        gameplayData = data;

        this.prefabs = new TerrainPrefabs( gameplayData.name );
        TypeContainer<TerrainType>.add( this.gameplayData.name, this );
    }
예제 #7
0
    /// <summary>
    /// Destructor for TerrainPrefabs
    /// </summary>
    /// <param name="terrainPrefabs"></param>
    public static void Destroy(TerrainPrefabs terrainPrefabs)
    {
        GameObject.Destroy( terrainPrefabs.block );
        foreach (GameObject wall in terrainPrefabs.walls)
            GameObject.Destroy( wall );

        terrainPrefabs = null;
    }