From 540727f0710039343063d6f1c79e682ac194684f Mon Sep 17 00:00:00 2001 From: Mootfrost777 Date: Sat, 17 Aug 2024 00:59:41 +0300 Subject: [PATCH] Add updates for interaction --- .../ServerToClient/UpdateGameObjectDeleted.cs | 13 +++++++++++++ ...actionAvailable.cs => UpdateInteractionReady.cs} | 2 +- .../NetworkManager/Updates/UpdateData.cs | 2 ++ .../Entities/Interactables/Interactable.cs | 7 ++++++- 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameObjectDeleted.cs rename ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/{UpdateInteractionAvailable.cs => UpdateInteractionReady.cs} (83%) diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameObjectDeleted.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameObjectDeleted.cs new file mode 100644 index 0000000..cf8cdc7 --- /dev/null +++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameObjectDeleted.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient +{ + public class UpdateGameObjectDeleted : UpdateData //Хранит объект, который надоу удлить + { + public UpdateGameObjectDeleted() { UpdateType = "UpdateGameObjectDeleted"; } + } +} \ No newline at end of file diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateInteractionAvailable.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateInteractionReady.cs similarity index 83% rename from ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateInteractionAvailable.cs rename to ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateInteractionReady.cs index 3b7787b..1ccc49e 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateInteractionAvailable.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateInteractionReady.cs @@ -1,6 +1,6 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient; -public class UpdateInteractionAvailable(int idEntity, bool isReady) +public class UpdateInteractionReady(int idEntity, bool isReady) : UpdateData // при изменении возможности повзаимодействовать с объектом { public int IdEntity { get; set; } = idEntity; diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/UpdateData.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/UpdateData.cs index bb462ad..1074378 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/UpdateData.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/UpdateData.cs @@ -20,6 +20,8 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates [JsonDerivedType(typeof(UpdateTileCreated))] [JsonDerivedType(typeof(UpdateInput))] [JsonDerivedType(typeof(UpdatePlayerExit))] + [JsonDerivedType(typeof(UpdateInteractionReady))] + [JsonDerivedType(typeof(UpdateInteraction))] public class UpdateData { diff --git a/ZoFo/GameCore/GameObjects/Entities/Interactables/Interactable.cs b/ZoFo/GameCore/GameObjects/Entities/Interactables/Interactable.cs index 60d4576..6299155 100644 --- a/ZoFo/GameCore/GameObjects/Entities/Interactables/Interactable.cs +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Interactable.cs @@ -16,6 +16,11 @@ public class Interactable : Entity private void ChangeInteraction(object sender, CollisionComponent e, bool isReady) { - AppManager.Instance.server.AddData(new UpdateInteractionAvailable((sender as Player).Id, isReady)); + AppManager.Instance.server.AddData(new UpdateInteractionReady((sender as Player).Id, isReady)); + } + + public void OnInteraction() + { + } } \ No newline at end of file