diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameObjectDeleted.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameObjectDeleted.cs index 88d4e98..25415e1 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameObjectDeleted.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameObjectDeleted.cs @@ -12,5 +12,6 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient public class UpdateGameObjectDeleted : UpdateData { public UpdateGameObjectDeleted() { UpdateType = "UpdateGameObjectDeleted"; } + public string GameObjectType; } } \ No newline at end of file diff --git a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Collectable.cs b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Collectable.cs index b25d7a3..9bb5227 100644 --- a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Collectable.cs +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Collectable.cs @@ -13,6 +13,8 @@ public class Collectable : Interactable public override void OnInteraction(object sender, CollisionComponent e) { - + // + AppManager.Instance.server.AddData(new UpdateLoot()); + AppManager.Instance.server.DeleteObject(this); } } diff --git a/ZoFo/GameCore/Server.cs b/ZoFo/GameCore/Server.cs index 93c7018..c7b6162 100644 --- a/ZoFo/GameCore/Server.cs +++ b/ZoFo/GameCore/Server.cs @@ -137,10 +137,23 @@ namespace ZoFo.GameCore } AddData(new UpdateGameObjectCreated() - { GameObjectType = gameObject.GetType().Name } + { GameObjectType = gameObject.GetType().Name } ); } + + /// + /// Удаляет игровой объект + /// + /// + public void DeleteObject(GameObject gameObject) + { + gameObjects.Remove(gameObject); + AddData(new UpdateGameObjectDeleted() + { GameObjectType = gameObject.GetType().Name} + ); + } } + #endregion }