void OnTriggerStay(Collider active) { if(Input.GetKeyDown(KeyCode.Delete)) { EcosystemEntityTree tree = new EcosystemEntityTree(); EcosystemEntityHuman human = new EcosystemEntityHuman(); EcosystemEntityCow cow = new EcosystemEntityCow(); Debug.Log(active.tag); switch (active.tag) { case "ecosystemTrees": { tree.Remove(active); break; } case "ecosystemCow": { cow.Remove(active); break; } case "ecosystemHuman": { human.Remove(active); break; } default: { break; } } //Destroy(active); active.renderer.material.color = Color.red; } }
/// <summary> /// Ecosystems the post calculations. /// </summary> void EcosystemPostCalculations() { EcosystemEntityTree tree = new EcosystemEntityTree(); EcosystemEntityHuman human = new EcosystemEntityHuman(); EcosystemEntityCow cow = new EcosystemEntityCow(); //Create Tree if (EcosystemAtmosphere.Co > 90) { tree.Create(); } //Create Human if (EcosystemAtmosphere.Oxygen > 90) { human.Create(); } //Create Cow if (EcosystemAtmosphere.Oxygen > 140) { cow.Create(); } //Destroy Tree if (EcosystemAtmosphere.Co < 8) { tree.Remove(); } //Destroy Human if (EcosystemAtmosphere.Oxygen < 8) { human.Remove(); } //Destroy Cow if (EcosystemAtmosphere.Oxygen < 15) { cow.Remove(); } }