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; } }
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); } }
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; } } }
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; } } }
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; } }
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; } }
private void DoRemoved(params TSectorEntity[] entities) { var args = new ManagerItemsChangedEventArgs <TSectorEntity>(entities); Removed?.Invoke(this, args); }