Пример #1
0
 // when rabbit collects mushroom, it disappears
 // if rabbit is small, he dies
 // if he is big, he becomes smaller
 protected override void OnRabbitHit(HeroRabbit rabbit)
 {
     if (!rabbit.IsBombInvulnerable)
     {
         if (rabbit.IsBig)
         {
             rabbit.Diminish();
         }
         else
         {
             rabbit.DieOnPlatform();
         }
         CollectedHide();
     }
 }
Пример #2
0
    protected override void OnRabbitHit(HeroRabbit rabbit)
    {
        float myPosY     = transform.position.y;
        float rabbitPosY = HeroRabbit.LastRabbit.transform.position.y;

        if (rabbitPosY - myPosY >= _rabbitWinHeight)
        {
            // rabbit is higher, orc dies and rabbit jumps
            Die();
            rabbit.Jump();
        }
        else
        {
            // orc attacks
            Kill();
            // rabbit dies
            rabbit.DieOnPlatform();
        }
    }