示例#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();
        }
示例#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();
     }
 }
示例#3
0
        public void RemovePhysical(Physics phy)
        {

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

            phy.setMap(this);
            lock (_objects)
            {
                _objects.Add(phy);
            }
            phy.StartMoving();
        }
示例#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();
     }
 }