private void Awake() { if (LifeSpawnerInstance == null) { LifeSpawnerInstance = this; } Life.GetComponent <Rigidbody2D>().gravityScale = 0.1f; }
/// <summary> /// When called, this function generates noise data and rebuilds the mesh. /// </summary> public void SpawnChunk(Int3 gridPos) { if (!EditorApplication.isPlaying) { return; } mesh = GetComponent <MeshFilter>(); GenerateNoiseData(); GenerateMesh(); this.gridPos = gridPos; if (!VoxelUniverse.main.terrainOnly) { LifeSpawner spawner = GetComponent <LifeSpawner>(); if (spawner) { spawner.SpawnSomeLife(); } } }