Example #1
0
        private void ActorManager_Added(object sender, ManagerItemsChangedEventArgs <IActor> e)
        {
            foreach (var actor in e.Items)
            {
                Map.HoldNode(actor.Node, actor);

                actor.Person.Survival.Dead += ActorState_Dead;
            }
        }
Example #2
0
        private void ActorManager_Added(object?sender, ManagerItemsChangedEventArgs <IActor> e)
        {
            foreach (var actor in e.Items)
            {
                HoldNodes(actor.Node, actor, Map);

                if (actor.Person.GetModuleSafe <ISurvivalModule>() != null)
                {
                    actor.Person.GetModule <ISurvivalModule>().Dead += ActorState_Dead;
                }

                actor.Moved += Actor_Moved;
                UpdateFowData(actor);
            }
        }
Example #3
0
        private void StaticObjectManager_Remove(object?sender, ManagerItemsChangedEventArgs <IStaticObject> e)
        {
            foreach (var container in e.Items)
            {
                if (container.IsMapBlock)
                {
                    Map.ReleaseNode(container.Node, container);
                }

                if (container.GetModule <IPropContainer>() is ILootContainer lootContainer)
                {
                    lootContainer.ItemsRemoved -= LootContainer_ItemsRemoved;
                }
            }
        }
Example #4
0
        private void PropContainerManager_Remove(object sender, ManagerItemsChangedEventArgs <IPropContainer> e)
        {
            foreach (var container in e.Items)
            {
                if (container.IsMapBlock)
                {
                    Map.ReleaseNode(container.Node, container);
                }

                if (container is ILootContainer)
                {
                    container.ItemsRemoved -= LootContainer_ItemsRemoved;
                }
            }
        }
Example #5
0
        private void ActorManager_Remove(object sender, ManagerItemsChangedEventArgs <IActor> e)
        {
            // Когда актёры удалены из сектора, мы перестаём мониторить события на них.
            foreach (var actor in e.Items)
            {
                ReleaseNodes(actor, Map);

                if (actor.Person.GetModuleSafe <ISurvivalModule>() != null)
                {
                    actor.Person.GetModule <ISurvivalModule>().Dead -= ActorState_Dead;
                }

                actor.Moved -= Actor_Moved;
            }
        }
Example #6
0
        private void ActorManager_Remove(object?sender, ManagerItemsChangedEventArgs <IActor> e)
        {
            foreach (var actor in e.Items)
            {
                ReleaseNodes(actor, Map);

                // Stop to handle actors' events then they leaves the sector.
                var survivalModule = actor.Person.GetModuleSafe <ISurvivalModule>();
                if (survivalModule != null)
                {
                    actor.Person.GetModule <ISurvivalModule>().Dead -= ActorState_Dead;
                }

                actor.Moved -= Actor_Moved;
            }
        }
Example #7
0
        private void DoRemoved(params TSectorEntity[] entities)
        {
            var args = new ManagerItemsChangedEventArgs <TSectorEntity>(entities);

            Removed?.Invoke(this, args);
        }