예제 #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();
        }
    }