Beispiel #1
0
        public void AddObject(GameObject obj)
        {
            if (Capacity >= LastIterator)
            {
                Trim();
                Expand();
            }
            gameVisibilityMap[LastIterator].Initialize(obj);

            LastIterator++;
        }
Beispiel #2
0
 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);
         }
     }
 }
Beispiel #3
0
 public void Remove(GameObject obj)
 {
     gameVisibilityMap.First(x => ReferenceEquals(x.Owner.Value, obj)).Delete();
 }
Beispiel #4
0
 public void Initialize(GameObject obj)
 {
     Owner = new WeakObject<GameObject>(obj);
     index = obj.Index;
 }