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

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