Пример #1
0
 /// <summary>
 /// Clears all of the ObjMaint tables for an object
 /// </summary>
 private void RemoveAllObjects()
 {
     KnownObjects.Clear();
     VisibleObjects.Clear();
     DestructionQueue.Clear();
     KnownPlayers.Clear();
     VisibleTargets.Clear();
 }
Пример #2
0
        public void Update()
        {
            if (Owner == null || Owner.Data == null || Owner.Data.GetBody() == null)
            {
                Active = false;
                return;
            }

            bool isPlayer = Owner is Player;

            Collider2D[] hits = Physics2D.OverlapCircleAll(Owner.Data.GetBody().transform.position, VisibleRadius);

            if (isPlayer)
            {
                foreach (GameObject o in KnownObjects)
                {
                    if (o == null)
                    {
                        continue;
                    }

                    AbstractData d = o.GetData();

                    if (d != null)
                    {
                        d.IsVisibleToPlayer = false;
                    }
                }
            }

            KnownObjects.Clear();

            foreach (Collider2D h in hits)
            {
                if ("Cave Generator".Equals(h.gameObject.name) || h.gameObject.Equals(Owner.GetData().gameObject))
                {
                    continue;
                }

                if (isPlayer)
                {
                    AbstractData d = h.gameObject.GetData();

                    if (d != null)
                    {
                        d.IsVisibleToPlayer = true;
                    }
                }

                KnownObjects.Add(h.gameObject);
            }
        }
Пример #3
0
        /// <summary>
        /// Clears known objects and leads to resending of the creation packet
        /// during the next Map-Update.
        /// This is only needed for teleporting or body-transfer.
        /// Requires map context.
        /// </summary>
        internal void ClearSelfKnowledge()
        {
            KnownObjects.Clear();
            NearbyObjects.Clear();
            if (m_observers != null)
            {
                m_observers.Clear();
            }

            /*foreach (var item in m_inventory.GetAllItems(true))
             * {
             *  item.m_unknown = true;
             *  m_itemsRequiringUpdates.Add(item);
             * }*/
        }
Пример #4
0
        /// <summary>
        /// Performs any needed object/object pool cleanup.
        /// </summary>
        public override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            CancelSummon(false);

            if (m_bgInfo != null)
            {
                m_bgInfo.Character = null;
                m_bgInfo           = null;
            }

            m_InstanceCollection = null;

            if (m_activePet != null)
            {
                m_activePet.Delete();
                m_activePet = null;
            }

            m_minions   = null;
            m_activePet = null;

            if (m_skills != null)
            {
                m_skills.m_owner = null;
                m_skills         = null;
            }

            if (m_talents != null)
            {
                m_talents.Owner = null;
                m_talents       = null;
            }

            if (m_inventory != null)
            {
                m_inventory.m_container     = null;
                m_inventory.m_owner         = null;
                m_inventory.m_ammo          = null;
                m_inventory.m_currentBanker = null;
                m_inventory = null;
            }

            if (m_mailAccount != null)
            {
                m_mailAccount.Owner = null;
                m_mailAccount       = null;
            }

            m_groupMember = null;

            if (m_reputations != null)
            {
                m_reputations.Owner = null;
                m_reputations       = null;
            }

            if (m_InstanceCollection != null)
            {
                m_InstanceCollection.Dispose();
            }

            if (m_achievements != null)
            {
                m_achievements.m_owner = null;
                m_achievements         = null;
            }

            if (m_CasterReference != null)
            {
                m_CasterReference.Object = null;
                m_CasterReference        = null;
            }

            if (m_looterEntry != null)
            {
                m_looterEntry.m_owner = null;
                m_looterEntry         = null;
            }

            if (m_ExtraInfo != null)
            {
                m_ExtraInfo.Dispose();
                m_ExtraInfo = null;
            }

            KnownObjects.Clear();
            WorldObjectSetPool.Recycle(KnownObjects);
        }