Ejemplo n.º 1
0
 public void unload()
 {
     if (isLoaded_ == true)
     {
         GameObject.Destroy(gameObject_);
         tileMapGraphics_ = null;
         tileMap_         = null;
         isLoaded_        = false;
     }
 }
Ejemplo n.º 2
0
    public void Unload()
    {
        if (isLoaded != true)
        {
            return;
        }

        Object.Destroy(gameObject);
        tileMapGraphics = null;
        tileMap         = null;
        isLoaded        = false;
    }
Ejemplo n.º 3
0
    public void load()
    {
        if (isLoaded_ == false)
        {
            gameObject_      = Object.Instantiate(Resources.Load("Prefabs/World/Chunk"), GameObject.Find("WorldObject").transform) as GameObject;
            tileMapGraphics_ = gameObject_.GetComponent <TileMapGraphics>();
            tileMap_         = new TileMap(CHUNK_SIZE, CHUNK_SIZE, seed_, idX_, idZ_);
            tileMapGraphics_.generateMesh(tileMap_, new Vector3(posX_, 0, posZ_), TILE_SIZE);

            //spawn one random enemy at random position
            if (!spawnDone_)
            {
                Vector3 position = new Vector3(posX_ + Random.Range(0, size()), 0, posZ_ + Random.Range(0, size()));
                EnemySpawner.instance.spawnRandom(position);
                spawnDone_ = true;
            }

            isLoaded_ = true;
        }
    }
Ejemplo n.º 4
0
    public void Load()
    {
        if (isLoaded)
        {
            return;
        }

        gameObject = new GameObject(GameObjectName);
        gameObject.transform.parent = parentObject.transform;
        gameObject.layer            = LayerMask.NameToLayer("Ground");

        tileMapGraphics          = gameObject.AddComponent <TileMapGraphics>();
        tileMapGraphics.Material = worldCreationParams.WorldData.TerrainMaterial;
        tileMap = new TileMap(ChunkSize, ChunkSize, worldCreationParams.Seed, idX, idZ);
        tileMapGraphics.GenerateMesh(tileMap, new Vector3(posX, 0, posZ), TileSize);

        //spawn one random enemy at random position
        if (!spawnDone)
        {
            SpawnEnemies();
        }

        isLoaded = true;
    }