public void Reproduce(bool check) { if (!check) { return; } if (hunterVariables.hunterHunger > 4000 && hunterVariables.hunterThirst > 4000 && Time.time - lastBorn > 20) { lastBorn = Time.time; hunterVariables.hunterHunger -= 3500; hunterVariables.hunterThirst -= 3500; Debug.Log("Hunter Born"); GameObject child = Instantiate(gameObject, GameObject.FindWithTag("Hunters").transform); child.transform.position = transform.position; child.name = "Hunter"; HunterVariables childVarScript = child.GetComponent <HunterVariables>(); child.GetComponent <HunterAgent>().firstHunter = false; childVarScript.hunterSpeed += (float)(Random.Range(0, 201) - 100) / 1000; childVarScript.hunterVision += (float)(Random.Range(0, 201) - 100) / 1000; childVarScript.hunterSmell += (float)(Random.Range(0, 201) - 100) / 1000; childVarScript.hunterHunger = 500; childVarScript.hunterThirst = 500; childVarScript.CheckVariables(); AddReward(1f); } }
private void Start() { varScript = GetComponent <HunterVariables>(); agentScript = GetComponent <HunterAgent>(); hunterLayer = 1 << 10; peaterLayer = 1 << 12; plantLayer = 1 << 11; waterLayer = 1 << 4; }
private void Start() { hunterScript = gameObject.GetComponent <HunterMethods>(); hunterVariables = gameObject.GetComponent <HunterVariables>(); worldScript = GameObject.FindWithTag("GenObject").GetComponent <MakeMesh>(); }