コード例 #1
0
        public bool Deregister(GameObject _object)
        {
            if (_object == null || !Enabled)
            {
                return(false);
            }

            ICECreatureEntity _entity = _object.GetComponent <ICECreatureEntity>();

            if (_entity != null)
            {
                OnGroupMessage -= _entity.Message.ReceiveGroupMessage;
            }

            if (SuspendedObjects.Count > 0)
            {
                SuspendedObjects.Remove(_object);
            }

            if (ActiveObjects.Count > 0)
            {
                return(ActiveObjects.Remove(_object));
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
        /// <summary>
        /// Add all the objects in ObjectsToAdd to ActiveObjects, then update ActiveObjects before deleting objects in ObjectsToRemove
        /// </summary>
        /// <param name="elapsedGameTime">The seconds that have elapsed since the last update loop</param>
        public override void Update(float elapsedGameTime)
        {
            // Always call the super class' function - it will deal with whether it should run it itself
            base.Update(elapsedGameTime);

            // Add the objects and then clear the list - it is only a temporary holder
            ActiveObjects.AddRange(ObjectsToAdd);
            ObjectsToAdd.Clear();

            // Loop through the active object
            foreach (T obj in ActiveObjects)
            {
                if (obj.ShouldUpdate)
                {
                    // Update the object
                    obj.Update(elapsedGameTime);
                }
            }

            // Remove all the objects that are no longer alive
            ActiveObjects.RemoveAll(x => x.IsAlive == false);

            // Remove all the objects we have marked to remove
            foreach (T obj in ObjectsToRemove)
            {
                ActiveObjects.Remove(obj);
            }
            ObjectsToRemove.Clear();    // Clear the list - it is only a temporary holder
        }
コード例 #3
0
 public void PoolEnemyObject(GameObject enemyGameObject)
 {
     //Debug.LogError("Pooling " + enemyGameObject.GetInstanceID() + enemyGameObject.GetComponent("Enemy").GetType());
     enemyGameObject.SetActive(false);
     ActiveObjects.Remove(enemyGameObject);
     InactiveObjects.Add(enemyGameObject);
 }
コード例 #4
0
        /// <summary>
        /// Удалить активный объект с карты
        /// </summary>
        /// <param name="Id">Идентификатор объекта</param>
        public void RemoveActiveObject(Guid Id)
        {
            MapActiveObjectState ActiveObject = GetActiveObjectById(Id);

            DeAttachActiveObject(ActiveObject);
            ActiveObjects.Remove(Id);
        }
コード例 #5
0
        private void _Despawn(GameObject toDespawn)
        {
            toDespawn.SetActive(false);
            toDespawn.transform.parent = Holder.transform;

            ActiveObjects.Remove(toDespawn);
            InactiveObjects.Add(toDespawn);
        }
コード例 #6
0
ファイル: ReplayWorld.cs プロジェクト: kmlkmljkl2/Anarchy
        public bool DestroyObject(GameObject go)
        {
            var resObj = ActiveObjects.FirstOrDefault(x => x.SourceObject == go);

            if (resObj != null)
            {
                ActiveObjects.Remove(resObj);
                return(true);
            }

            return(false);
        }
コード例 #7
0
    public void Insert(GameObject gameObject)
    {
        gameObject.transform.DOKill();
        if (gameObject.activeInHierarchy)
        {
            gameObject.SetActive(false);
        }

        PooledObject obj = poolObjectLookup[gameObject];

        ActiveObjects.Remove(obj);
        Push(obj);
    }
コード例 #8
0
ファイル: Scene.cs プロジェクト: maddnias/DotEscape
        public void Reset()
        {
            (Globals.ActiveScene.ActiveObjects.First(x => x is Player) as Player).Reset(PlayerStart);
            AquiredCoins = 0;
            ActiveObjects.ForEach(x =>
                                      {
                                          if (!(x is Coin))
                                              return;

                                          ActiveObjects.Remove(x);
                                      });
            ActiveObjects.AddRange(GetCoins());
        }
コード例 #9
0
        public void DestroyItem(GameObject _object)
        {
            if (_object == null && EntityGameObject != _object)
            {
                return;
            }

            SuspendedObjects.Remove(_object);
            ActiveObjects.Remove(_object);

            if (!CompareByID(_object.GetInstanceID()))
            {
                CreatureRegister.Destroy(_object);
            }
        }
コード例 #10
0
        /// <summary>
        ///     对象关闭时登记
        /// </summary>
        public static void OnObjectClose(IService obj)
        {
            Logger.Information("[服务关闭] {0}", obj.ServiceName);
            bool can;

            lock (ActiveObjects)
            {
                ActiveObjects.Remove(obj);
            }
            can = ActiveObjects.Count == 0;
            if (can)
            {
                ActiveSemaphore.Release(); //发出完成信号
            }
        }
コード例 #11
0
        /// <summary>
        /// Remove the specified _object by using the UseSoftRespawn option of the ReferenceGroup. If UseSoftRespawn
        /// is active the specified _object will be moved from the ActiveObjects list to the SuspendedObjects list and
        /// its values will be adjusted to the default values, otherwise if UseSoftRespawn is disabled the specified
        /// _object will be finally destroyed.
        /// </summary>
        /// <param name="_object">Object.</param>
        public bool Remove(GameObject _object)
        {
            if (_object == null)
            {
                return(false);
            }

            if (UseSoftRespawn)
            {
                //Debug.Log( "ReferenceGroupObject.Remove: " + _object.name );

                _object.transform.position = Vector3.zero;
                _object.transform.rotation = Quaternion.identity;
                _object.SetActive(false);

                if (ActiveObjects.Count > 0)
                {
                    return(ActiveObjects.Remove(_object));
                }

                SuspendedObjects.Add(_object);

                ICECreatureEntity _entity = _object.GetComponent <ICECreatureEntity>();

                // if the object is an ICE entity we have to adapt the parent according to it's hierarchy settings
                if (_entity != null && _entity.UseHierarchyManagement)
                {
                    _object.transform.SetParent(UpdateGroupParent(), true);
                }


                //TODO: CreatureRegister.DetachFromTransform( _object );
            }
            else
            {
                DestroyItem(_object);
            }

            return(true);
        }
コード例 #12
0
 public void ReturnObject(GameObject obj)
 {
     obj.SetActive(false);
     ActiveObjects.Remove(obj);
     AvailableObjects.Add(obj);
 }
コード例 #13
0
 public void PoolBullets(GameObject enemyGameObject)
 {
     enemyGameObject.SetActive(false);
     ActiveObjects.Remove(enemyGameObject);
     InactiveObjects.Add(enemyGameObject);
 }