public override void GetCollided(ICollideable collider) { base.GetCollided(collider); if (this.IsCollideable()) { if (collider.GetType() == typeof(Rat)) { this.Die(); } } }
public override void GetCollided(ICollideable collider) { if (collider.GetType() == typeof(Rat)) { Console.WriteLine($"{this.ToString()} survived to rat attack"); } else { this.Nuisible.GetCollided(collider); } }
public virtual void GetCollided(ICollideable collider) { if (this.IsCollideable()) { Console.WriteLine($" {this.ToString()} is getting collided by {collider.ToString()}"); if (collider.GetType() == typeof(Zombie) && this.GetType() != typeof(Zombie)) { this.Zombify(); Console.WriteLine($" {this.ToString()} turned into a Zombie. B"); } } }
public virtual void Collide(ICollideable collided) { if (this.IsCollideable()) { Console.WriteLine($" {this.ToString()} is colliding {collided.ToString()}"); collided.GetCollided(this); if (collided.GetType() == typeof(Zombie) && this.GetType() != typeof(Zombie)) { this.Zombify(); Console.WriteLine($" {this.ToString()} turned into a Zombie. A"); } } }