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

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