Exemple #1
0
 public override void GetCollided(ICollideable collider)
 {
     base.GetCollided(collider);
     if (this.IsCollideable())
     {
         if (collider.GetType() == typeof(Rat))
         {
             this.Die();
         }
     }
 }
Exemple #2
0
 public override void GetCollided(ICollideable collider)
 {
     if (collider.GetType() == typeof(Rat))
     {
         Console.WriteLine($"{this.ToString()} survived to rat attack");
     }
     else
     {
         this.Nuisible.GetCollided(collider);
     }
 }
Exemple #3
0
 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");
         }
     }
 }
Exemple #4
0
 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");
         }
     }
 }