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(); }
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(); } }
public void RemovePhysical(Physics phy) { phy.SetMap(null); lock (_objects) { _objects.Remove(phy); } }
public void AddPhysical(Physics phy) { phy.SetMap(this); lock (_objects) { _objects.Add(phy); } }
protected virtual void CollideObjects(Physics[] list) { }
public void AddPhysical(Physics phy) { phy.setMap(this); lock (_objects) { _objects.Add(phy); } phy.StartMoving(); }
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(); } }