示例#1
0
 public void RemoveObject(GamePoleObject obj)
 {
     Point[] oldPoses = o2p[obj].ToArray();
     for (int i = 0; i < oldPoses.Length; i++)
     {
         p2o[oldPoses[i]].Remove(obj);
     }
     o2p[obj] = null;
 }
示例#2
0
 public void ObjectMove(GamePoleObject obj)
 {
     Point[] oldPoses = o2p[obj].ToArray();
     Point[] newPoses = GetZones(obj);
     for (int i = 0; i < oldPoses.Length; i++)
     {
         p2o[oldPoses[i]].Remove(obj);
     }
     AppendObjectPoses(obj, newPoses);
 }
示例#3
0
 private void AppendObjectPoses(GamePoleObject obj, Point[] poses)
 {
     for (int i = 0; i < poses.Length; i++)
     {
         HashSet <GamePoleObject> o;
         if (!p2o.TryGetValue(poses[i], out o))
         {
             o             = new HashSet <GamePoleObject>();
             p2o[poses[i]] = o;
         }
         o.Add(obj);
     }
     o2p[obj] = new HashSet <Point>(poses);
 }
示例#4
0
 public void RemoveObject(GamePoleObject obj)
 {
     objects.Remove(obj);
     cache.RemoveObject(obj);
 }
示例#5
0
 public void AddObject(GamePoleObject obj)
 {
     objects.Add(obj);
     cache.AddObject(obj);
 }
示例#6
0
 public void AddObject(GamePoleObject obj)
 {
     Point[] zones = GetZones(obj);
     AppendObjectPoses(obj, zones);
 }
示例#7
0
 private Point[] GetZones(GamePoleObject obj)
 {
     return(GetZones(obj.Rectangle));
 }