Пример #1
0
    IEnumerator rabitDies(float duration, HeroRabit rabit)
    {
        Animator animatorRabit = rabit.GetComponent <Animator>();

        //Perform action ...
        animatorRabit.SetTrigger("die");
        //Wait
        yield return(new WaitForSeconds(duration));

        //Continue excution in few seconds
        //Other actions...
        LevelController.current.onRabitDeath(rabit);
    }
Пример #2
0
 protected override void OnRabitHit(HeroRabit rabit)
 {
     if (rabit.isBig())
     {
         Vector3 size = rabit.transform.localScale;
         rabit.transform.localScale = new Vector3(size.x / 1.3f, size.y / 1.3f, 0);
         rabit.setBig(false);
     }
     else
     {
         rabit.GetComponent <Animator>().SetBool("death", true);
     }
     this.CollectedHide();
 }
    public void OnRabitDeath(HeroRabit rabit)
    {
        if (SoundManager.Instance.isSoundOn() && deathSound != null)
        {
            deathSource.Play();
        }
        rabit.transform.position = this.startingPosition;
        SpriteRenderer renderer = rabit.GetComponent <SpriteRenderer> ();

        renderer.flipX = false;
        removeLife();
        if (rabit.IsBig)
        {
            rabit.BecomeSmaller();
        }
    }