public void AddObject(GameObject obj) { if (Capacity >= LastIterator) { Trim(); Expand(); } gameVisibilityMap[LastIterator].Initialize(obj); LastIterator++; }
public void SetPosition(GameObject gameObject, Point oldValue, Point value) { if (oldValue.IsEmpty) { GetCellByPoint(value).ObjectsInCell.Add(gameObject); } else { MapCell oldContainer = GetCellByPoint(oldValue); MapCell newContainer = GetCellByPoint(value); if (!oldContainer.Equals(newContainer)) { oldContainer.ObjectsInCell.Remove(gameObject); newContainer.ObjectsInCell.Add(gameObject); } } }
public void Remove(GameObject obj) { gameVisibilityMap.First(x => ReferenceEquals(x.Owner.Value, obj)).Delete(); }
public void Initialize(GameObject obj) { Owner = new WeakObject<GameObject>(obj); index = obj.Index; }