Пример #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;
            }
        }
Пример #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);
            }
        }
Пример #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;
                }
            }
        }
Пример #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;
                }
            }
        }
Пример #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;
            }
        }
Пример #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;
            }
        }
Пример #7
0
        private void DoRemoved(params TSectorEntity[] entities)
        {
            var args = new ManagerItemsChangedEventArgs <TSectorEntity>(entities);

            Removed?.Invoke(this, args);
        }