Exemple #1
0
        public Physics[] FindPhysicalObjects(Rectangle rect, Physics except)
        {
            List<Physics> list = new List<Physics>();
            lock (_objects)
            {
                foreach (Physics phy in _objects)
                {
                    if (phy.IsLiving && phy != except)
                    {
                        Rectangle t = phy.Bound;

                        t.Offset(phy.X, phy.Y);
                        if (t.IntersectsWith(rect))
                        {
                            list.Add(phy);
                        }
                    }
                }
            }
            return list.ToArray();
        }
Exemple #2
0
 protected override void CollideObjects(Physics[] list)
 {
     bool flag = false;
     foreach (Physics phy in list)
     {
         if (phy is Box)
         {
             m_actions.Add(new BombAction(m_lifeTime, ActionType.PICK, phy.Id, 0,0,0));
             m_owner.PickBox(phy as Box,false);
         }
         else
         {
             flag = true;
         }
     }
     if (flag)
     {
         Bomb();
     }
 }
Exemple #3
0
        public void RemovePhysical(Physics phy)
        {

            phy.SetMap(null);
            lock (_objects)
            {
                _objects.Remove(phy);
            }
        }
Exemple #4
0
 public void AddPhysical(Physics phy)
 {
     phy.SetMap(this);
     lock (_objects)
     {
         _objects.Add(phy);
     }
 }
Exemple #5
0
        protected virtual void CollideObjects(Physics[] list) 
        {
 
        }
Exemple #6
0
        public void AddPhysical(Physics phy)
        {

            phy.setMap(this);
            lock (_objects)
            {
                _objects.Add(phy);
            }
            phy.StartMoving();
        }
Exemple #7
0
 protected void CollideObjects(Physics[] list)
 {
     bool flag = false;
     foreach (Physics phy in list)
     {
         if (phy is Box)
         {
             _actions.Add(new BombAction(_currentTime, ActionType.PICK, phy.Id, 0,0,0));
             _owner.PickBox(phy as Box);
         }
         else
         {
             flag = true;
         }
     }
     if (flag)
     {
         Bomb();
     }
 }