public override void HitChara(Character chara) { if ((chara is Human || chara is Dog || chara is Bird || chara is Monkey) && isDeadFlag == false) { sound.PlaySE("momo"); isDeadFlag = true; mediator.ChangeHp(1); } }
public override void HitChara(Character other) { if (invincible == false) { if (other is Enemy || other is ShotEnemyBullet || other is Boss || other is BossBullet || other is BossBulletZ) { sound.PlaySE("dmg"); Direction dir = this.CheckDirection(other); mediator.ChangeHp(-1); damageShow = new CountDownTimer(0.2f); invincibleTime = new CountDownTimer(2f); invincible = true; if (dir == Direction.Right) { rightDamage = true; } else if (dir == Direction.Left) { leftDamage = true; } else if (dir == Direction.Top) { velocity.Y -= 8f; velocity.Y = (velocity.X < -8f) ? (velocity.Y) : (-8f); } else if (dir == Direction.Bottom) { velocity.Y += 8f; velocity.Y = (velocity.X < 8f) ? (velocity.Y) : (8f); Console.WriteLine("bottom"); } } } }