Example #1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown (KeyCode.Keypad0)) {
         EcosystemEntityTree tree = new EcosystemEntityTree();
         tree.Create();
             }
     if (Input.GetKeyDown (KeyCode.Keypad1)) {
         EcosystemEntityHuman human = new EcosystemEntityHuman();
         human.Create();
     }
     if (Input.GetKeyDown (KeyCode.Keypad2)) {
         EcosystemEntityCow cow = new EcosystemEntityCow();
         cow.Create();
     }
 }
Example #2
0
    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;
        }
    }
Example #3
0
    /// <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();
        }
    }