Beispiel #1
0
 /// <summary>
 /// Unregisters the specified game object
 /// </summary>
 /// <param name="GameObject">The game object to unregister</param>
 public void UnregisterGameObject(GameObject GameObject)
 {
     if (GameObject != null)
     {
         SetToAddTo.Remove(GameObject);
     }
 }
Beispiel #2
0
 public void RemoveFromSet()
 {
     if (inSet)
     {
         inSet = !_set.Remove(gameObject);
     }
 }
Beispiel #3
0
 public void OnDestroy()
 {
     if (interactibleObjectList != null)
     {
         Debug.Log("Object (" + name + ") removed from interactible object list (" + interactibleObjectList.name + ")");
         interactibleObjectList.Remove(gameObject);
     }
 }
Beispiel #4
0
        public IEnumerable <TObject> Sync(
            GameObjectSet gos,
            IEnumerable <TInfo> all,
            TContext context,
            bool updateOnCreate = false)
        {
            List <TObject> objectList = new List <TObject>();
            HashSet <int>  intSet     = new HashSet <int>((IEnumerable <int>) this.Forward.Values);

            foreach (TInfo info in all)
            {
                intSet.Remove(info.ID);
                TObject f;
                if (this.Reverse.TryGetValue(info.ID, out f))
                {
                    if (this._update != null)
                    {
                        this._update(f, info, context);
                    }
                }
                else
                {
                    f = this._create(gos, info, context);
                    this.Insert(f, info.ID);
                    objectList.Add(f);
                    if (updateOnCreate && this._update != null)
                    {
                        this._update(f, info, context);
                    }
                }
            }
            foreach (int r in intSet)
            {
                TObject f = this.Reverse[r];
                gos.Remove((IGameObject)f);
                gos.App.ReleaseObject((IGameObject)f);
                this.Remove(f, r);
            }
            return((IEnumerable <TObject>)objectList);
        }