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