Beispiel #1
0
 public Boolean Attack(List <Mob> mobs)
 {
     foreach (Mob mob in mobs)
     {
         Boolean isCollide = TestCollisions.Intersects(new Vector2(ModelPosition.X, ModelPosition.Y), reach,
                                                       new Vector2(mob.ModelPosition.X, mob.ModelPosition.Y), new Vector2(5, 5));
         if (isCollide)
         {
             mob.LostLife();
             return(true);
         }
     }
     return(false);
 }
Beispiel #2
0
 public void Update(GameTime gameTime)
 {
     for (int i = 0; i < GlobalsVar.Mobs.Count; i++)
     {
         Mob     mob       = GlobalsVar.Mobs.ElementAt(i);
         Boolean isCollide = TestCollisions.Intersects(new Vector2(ModelPosition.X, ModelPosition.Y), reach,
                                                       new Vector2(mob.ModelPosition.X, mob.ModelPosition.Y), new Vector2(5, 5));
         if (isCollide)
         {
             mob.Kill();
             GlobalsVar.PlayerLife -= 1;
             Console.WriteLine("The player have now: " + GlobalsVar.PlayerLife);
         }
     }
 }