Exemple #1
0
    private void Reproduce()     //try reproduce
    {
        //call every 2 hours
        if (fertile)
        {
            Rigidbody2D mate = GetClosestSheepMate(2f);

            if (mate != null)              //found a mate
            {
                if (!isRam)                //female
                {
                    gameControllerObject.PregnantSheep();
                    pregnant  = true;
                    coroutine = Pregnant(8.0f);                     //2 hours in game
                    StartCoroutine(coroutine);
                }
                else                       //male
                {
                    energy  = energy - 50; //energy used
                    fertile = false;       //need a short break
                }
            }
        }
    }