public void SheepDied(Sheep sheep, Wolf wolf = null)
    {
        Sheeps.Remove(sheep);

        // Clean up
        BuildQueue();

        if (TotalSheeps > 0)
        {
            sheep.Die();
        }
        else
        {
            sheep.TriggerGameOverSequence(wolf);
        }
    }
Пример #2
0
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        Sheep sheep = animator.GetComponent <Sheep>();

        sheep.Die();
    }
Пример #3
0
 void Update()
 {
     //verifica se tem q resetar o jogo
     if (Input.GetButtonDown("reset"))
     {
         Application.LoadLevel(0);
         return;
     }
     if (blankTempo > 0)
     {
         blankTempo -= Time.deltaTime;
         if (blankTempo < 0)
         {
             blankTempo = 0;
         }
         blank.color = new Color(1, 1, 1, blankTempo * .25f + .5f);
     }
     if (startTempo > 0)
     {
         startTempo      -= Time.deltaTime;
         audioBg.volume  -= Time.deltaTime;
         audioBad.volume -= Time.deltaTime;
         if (startTempo < 0)
         {
             startTempo = 0;
         }
         fade.color = new Color(fade.color.r, fade.color.g, fade.color.b, startTempo);
     }
     if (levelTempo > 0)
     {
         levelTempo      -= Time.deltaTime;
         audioBg.volume  -= Time.deltaTime;
         audioBad.volume -= Time.deltaTime;
         fade.color       = new Color(fade.color.r, fade.color.g, fade.color.b, (3 - levelTempo) * .5f);
         if (levelTempo <= 0)
         {
             levelTempo       = 0;
             Content.firstRun = false;
             Application.LoadLevel(1);
             return;
         }
     }
     if (credits)
     {
         const int duration = 30;
         if (creditsTempo < duration)
         {
             creditsTempo += Time.deltaTime * 1.5f;
             if (creditsTempo >= duration || Input.GetButtonDown("jump"))
             {
                 levelTempo = 4;
                 fading.SetBool("animate", true);
                 fade.color = new Color(0, 0, 0, 0);
             }
         }
         else
         {
             creditsTempo += Time.deltaTime;
         }
         creditsScroll.localPosition = new Vector3(0, creditsTempo - 10, 0);
         return;
     }
     if (fadeTempo > 0)
     {
         fadeTempo -= Time.deltaTime;
         fade.color = new Color(fade.color.r, fade.color.g, fade.color.b, 2 - fadeTempo);
         if (fadeTempo <= 0)
         {
             startTempo = 1;
             credits    = true;
             creditsTr.localPosition = Vector3.zero;
         }
     }
     //atualiza o sistema de cores
     Colouriser.UpdateStatic();
     //atualiza a resolução sempre que detectar mudança na janela
     if (width != Screen.width || height != Screen.height)
     {
         SetCamera();
     }
     //atualiza o fisheye
     if (fisheyeTempo > 0)
     {
         fisheyeTempo -= Time.deltaTime;
         if (fisheyeTempo < 0)
         {
             fisheyeTempo = 0;
         }
         fisheye.strengthX = fisheye.strengthY = fisheyeTempo * fisheyeTempo * .25f + .05f;
     }
     else if (fisheyeTempo < 0)
     {
         fisheyeTempo += Time.deltaTime;
         if (fisheyeTempo > 0)
         {
             fisheyeTempo = 0;
         }
         fisheye.strengthX = fisheye.strengthY = -fisheyeTempo * fisheyeTempo * .05f + .05f;
     }
     //atualiza o medidor
     if (sheep.highnessUpdate)
     {
         if (sheep.highness > 0)
         {
             meterTr.localPosition = new Vector3(meterTr.localPosition.x, meterTr.localPosition.y, 0);
         }
         else
         {
             meterTr.localPosition = new Vector3(meterTr.localPosition.x, meterTr.localPosition.y, 500);
         }
     }
     if (sheep.highness > 0 && fadeTempo == 0)
     {
         if (levelIndex == levelCount - 1 && sheepTr.localPosition.y < -5)
         {
             FadeOut(true);
         }
         else
         {
             badTripPos += Time.deltaTime;
             if (badTripPos >= sheepTr.localPosition.x)
             {
                 sheep.Die();
             }
             badTripTr.localPosition = new Vector3(badTripPos, badTripTr.localPosition.y, badTripTr.localPosition.z);
         }
     }
     meterHeight.localPosition = new Vector3(meterHeight.localPosition.x, sheep.highnessFloat - 1, meterHeight.localPosition.z);
     meterHeight.localScale    = new Vector3(meterHeight.localScale.x, (sheep.highnessFloat - 1) * .4f, meterHeight.localScale.z);
 }