Пример #1
0
 public virtual void Shoot(double rotation, int fromX, int fromY, MapBase map, double aimX, double aimY)
 {
     if (Content != null && this.Bullets != null && ammo > 0)
     {
         //TODO: Ray Trace & Muzzle Flash Goes Here
         int hitEnemies = 0;
         Ray2D ray = new Ray2D(new Vector2(fromX, fromY), new Vector2(float.Parse(aimX.ToString()), float.Parse(aimY.ToString())));
         ObjectBase o = ray.FirstIntersect(map.Objects);
         if (o != null)
         {
             o.OnHit(this, new Vector2(fromX, fromY));
             hitEnemies++;
             ObjectBase o2 = ray.IndexIntersect(map.Objects, 2);
             if (o2 != null)
             {
                 o2.OnHit(this, new Vector2(fromX, fromY));
                 float oDist = Vector2.Distance(new Vector2(fromX, fromY), o.Position);
                 float o2Dist = Vector2.Distance(new Vector2(fromX, fromY), o2.Position);
             }
         }
         ammo--;
     }
 }