Exemplo n.º 1
0
    public void Reproduce(bool check)
    {
        if (!check)
        {
            return;
        }
        if (peaterVariables.peaterHunger > 4000 && peaterVariables.peaterThirst > 4000 && Time.time - lastBorn > 20)
        {
            lastBorn = Time.time;

            peaterVariables.peaterThirst -= 3000;
            peaterVariables.peaterHunger -= 3000;

            Debug.Log("Plant Eater Born");
            GameObject child = Instantiate(gameObject, GameObject.FindWithTag("Planteaters").transform);
            child.transform.position = transform.position;
            child.name = "Planteater";
            PlanteaterVariables childVarScript = child.GetComponent <PlanteaterVariables>();
            child.GetComponent <PEaterAgent>().firstPeater = false;

            childVarScript.peaterSpeed  += (float)(Random.Range(0, 201) - 100) / 1000;
            childVarScript.peaterVision += (float)(Random.Range(0, 201) - 100) / 1000;
            childVarScript.peaterSmell  += (float)(Random.Range(0, 201) - 100) / 1000;
            childVarScript.peaterHunger  = 500;
            childVarScript.peaterThirst  = 500;

            childVarScript.CheckVariables();
            AddReward(1f);
        }
    }
    private void Start()
    {
        varScript   = GetComponent <PlanteaterVariables>();
        agentScript = GetComponent <PEaterAgent>();

        hunterLayer = 1 << 10;
        peaterLayer = 1 << 12;
        plantLayer  = 1 << 11;
        waterLayer  = 1 << 4;
    }
Exemplo n.º 3
0
 void Start()
 {
     peaterScript    = gameObject.GetComponent <PlanteaterMethods>();
     peaterVariables = gameObject.GetComponent <PlanteaterVariables>();
     worldScript     = GameObject.FindWithTag("GenObject").GetComponent <MakeMesh>();
 }