Exemplo n.º 1
0
 public virtual void Hit(IMario player, Vector2 direction)
 {
     if (player.HasStar()) {
         Enemy.Kill();
         SoundManager.PlayKickSound();
     } else if (direction.Y < Utility.ZERO) {
         Enemy.CurrentState = Enemy is Koopa
             ? (EnemyStateBase)new KoopaKnockedOutState(Enemy)
             : new GoombaStompedState(Enemy);
         player.InvincibilityPulse(Utility.DELAY);
         SoundManager.PlayStompSound();
     } else {
         player.TakeDamage();
         
     }
 }
Exemplo n.º 2
0
 public override void Hit(IMario player, Vector2 direction)
 {
     if (damageDelay > Utility.ZERO) return;
     if (player.HasStar()) {
         Enemy.Kill();
         SoundManager.PlayKickSound();
     } else if (direction.Y < Utility.ZERO || !CanHarmPlayer()) {
         if (!CanHarmPlayer()) {
             Enemy.Velocity = player.Bounds.Center.X <= Enemy.Bounds.Center.X ? new Vector2(Utility.KOOPA_HIT_VELOCITY, Enemy.Velocity.Y) : new Vector2(-Utility.KOOPA_HIT_VELOCITY, Enemy.Velocity.Y);
             SoundManager.PlayKickSound();
         } else
             Enemy.Velocity = Vector2.Zero;
         player.InvincibilityPulse(Utility.DELAY);
     } else {
         player.TakeDamage();
         Enemy.Velocity *= -Utility.ONE;
     }
     damageDelay = Utility.DELAY;
 }