Ejemplo n.º 1
0
    private void Birth()
    {
        //to do: work out the healthyness of sheep over the pregnancy
        sheepController tsheepController = sheepBaby.GetComponent <sheepController> ();
        int             counter          = 1;

        tsheepController.notLamb = false;
        //tsheepController.mom = rb;
        float t  = Random.Range(0f, 1f);
        float t2 = Random.Range(0.5f, 1f);         //cant be underweight

        Instantiate(sheepBaby, (Vector3)rb.position + new Vector3(0, 2, -1), Quaternion.identity);



        if (grownPercentage > t2 && 0.60f < (energy / 1000f))          //does random chance, the heavier the better chance of twins and cant be too tierd

        {
            Instantiate(sheepBaby, (Vector3)rb.position + new Vector3(2, 0, -1), Quaternion.identity);
            counter++;


            if (ageInYears > 3f && ageInYears < 6f)              //twins if correct age
            {
                if (t > 0.8f)
                {
                    Instantiate(sheepBaby, (Vector3)rb.position + new Vector3(0, -2, -1), Quaternion.identity);
                    counter++;
                }
            }
        }


        weight = weight - 3 * counter;
        energy = energy - 50 * counter;
        gameControllerObject.SheepBorn();
    }