Exemple #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;
 }
Exemple #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);
 }
Exemple #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);
 }
Exemple #4
0
 public void RemoveObject(GamePoleObject obj)
 {
     objects.Remove(obj);
     cache.RemoveObject(obj);
 }
Exemple #5
0
 public void AddObject(GamePoleObject obj)
 {
     objects.Add(obj);
     cache.AddObject(obj);
 }
Exemple #6
0
 public void AddObject(GamePoleObject obj)
 {
     Point[] zones = GetZones(obj);
     AppendObjectPoses(obj, zones);
 }
Exemple #7
0
 private Point[] GetZones(GamePoleObject obj)
 {
     return(GetZones(obj.Rectangle));
 }