diff --git a/ZoFo/GameCore/GameManagers/CollisionManager/CollisionManager.cs b/ZoFo/GameCore/GameManagers/CollisionManager/CollisionManager.cs index 8cf63f2..5242d4a 100644 --- a/ZoFo/GameCore/GameManagers/CollisionManager/CollisionManager.cs +++ b/ZoFo/GameCore/GameManagers/CollisionManager/CollisionManager.cs @@ -17,7 +17,10 @@ namespace ZoFo.GameCore.GameManagers.CollisionManager public List CollisionComponent; public List TriggerComponent; - + public void RegisterComponent() + { + + } public static bool CheckComponentCollision(List collisionComponents, CollisionComponent component) { diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateAnimation.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateAnimation.cs index 92fdc73..4e9b972 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateAnimation.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateAnimation.cs @@ -6,7 +6,10 @@ using System.Threading.Tasks; namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient { - public class UpdateAnimation : UpdateData //хранит новую анимации + /// + /// Хранит новое сосотяние анимации + /// + public class UpdateAnimation : UpdateData { public UpdateAnimation() { UpdateType = "UpdateAnimation"; } } diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateEntityHealth.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateEntityHealth.cs index 7e1efd3..71f95a2 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateEntityHealth.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateEntityHealth.cs @@ -6,7 +6,10 @@ using System.Threading.Tasks; namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient { - public class UpdateEntityHealth : UpdateData//хранит новое хп entity + /// + /// Обнивляет хп сущности + /// + public class UpdateEntityHealth : UpdateData { public UpdateEntityHealth() { UpdateType = "UpdateEntityHealth"; } } diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameEnded.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameEnded.cs index 193f6c1..d89c9a7 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameEnded.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameEnded.cs @@ -6,7 +6,10 @@ using System.Threading.Tasks; namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient { - public class UpdateGameEnded : UpdateData //хранит полученый лут и уведомляет о конце игры + /// + /// Хранит полученый лут и уведомляет о конце игры + /// + public class UpdateGameEnded : UpdateData { public UpdateGameEnded() { UpdateType = "UpdateGameEnded"; } } diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameObjectCreated.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameObjectCreated.cs index d3a154f..32052a0 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameObjectCreated.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameObjectCreated.cs @@ -6,7 +6,10 @@ using System.Threading.Tasks; namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient { - public class UpdateGameObjectCreated : UpdateData //Хранит объект, который только отправили + /// + /// Хранит объект, который только отправили + /// + public class UpdateGameObjectCreated : UpdateData { public UpdateGameObjectCreated() { UpdateType = "UpdateGameObjectCreated"; } } 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..88d4e98 --- /dev/null +++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameObjectDeleted.cs @@ -0,0 +1,16 @@ +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/UpdateInteraction.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateInteraction.cs new file mode 100644 index 0000000..e42f0f4 --- /dev/null +++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateInteraction.cs @@ -0,0 +1,10 @@ +namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient; + +/// +/// При попытке взаимодействия с объектом +/// +public class UpdateInteraction : UpdateData +{ + public int IdEntity { get; set; } + public string UpdateType { get; set; } +} \ No newline at end of file diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateInteractionReady.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateInteractionReady.cs new file mode 100644 index 0000000..db4d01d --- /dev/null +++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateInteractionReady.cs @@ -0,0 +1,14 @@ +namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient; + +/// +/// При изменении возможности повзаимодействовать с объектом +/// +/// +/// +public class UpdateInteractionReady(int idEntity, bool isReady) + : UpdateData +{ + public int IdEntity { get; set; } = idEntity; + public string UpdateType { get; set; } + public bool IsReady { get; set; } = isReady; +} \ No newline at end of file diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateLoot.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateLoot.cs index 19d390c..2337f74 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateLoot.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateLoot.cs @@ -6,7 +6,10 @@ using System.Threading.Tasks; namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient { - public class UpdateLoot : UpdateData //Хранит лут + /// + /// Хранит лут + /// + public class UpdateLoot : UpdateData { public UpdateLoot() { UpdateType = "UpdateLoot"; } } diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdatePlayerParametrs.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdatePlayerParametrs.cs index 818dcce..100c8d0 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdatePlayerParametrs.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdatePlayerParametrs.cs @@ -6,7 +6,10 @@ using System.Threading.Tasks; namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient { - public class UpdatePlayerParametrs : UpdateData //Хранит хп, радиацию + /// + /// Хранит хп, радиацию + /// + public class UpdatePlayerParametrs : UpdateData { public UpdatePlayerParametrs() { UpdateType = "UpdatePlayerParametrs"; } } diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdatePosition.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdatePosition.cs index ae58334..8d93d7b 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdatePosition.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdatePosition.cs @@ -6,7 +6,10 @@ using System.Threading.Tasks; namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient { - public class UpdatePosition : UpdateData //Хранит новую позицию + /// + /// Хранит новую позицию + /// + public class UpdatePosition : UpdateData { public UpdatePosition() { UpdateType = "UpdatePosition"; } } diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateTileCreated.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateTileCreated.cs index 2002a34..0799653 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateTileCreated.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateTileCreated.cs @@ -11,6 +11,9 @@ using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ClientToServer; namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient { + /// + /// При создании тайла + /// public class UpdateTileCreated : UpdateData { public UpdateTileCreated() { UpdateType = "UpdateTileCreated"; } diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/UpdateData.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/UpdateData.cs index bb462ad..a96b270 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/UpdateData.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/UpdateData.cs @@ -14,12 +14,15 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates [JsonDerivedType(typeof(UpdateEntityHealth))] [JsonDerivedType(typeof(UpdateGameEnded))] [JsonDerivedType(typeof(UpdateGameObjectCreated))] + [JsonDerivedType(typeof(UpdateGameObjectDeleted))] [JsonDerivedType(typeof(UpdateLoot))] [JsonDerivedType(typeof(UpdatePlayerParametrs))] [JsonDerivedType(typeof(UpdatePosition))] [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/Collectables/Collectable.cs b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Collectable.cs index b900e4a..d31d536 100644 --- a/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Collectable.cs +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Collectables/Collectable.cs @@ -2,7 +2,7 @@ using System; namespace ZoFo.GameCore.GameObjects.Entities.Interactables.Collectables; -public class Collectable : Entity +public class Collectable : Interactable { public Collectable(Vector2 position) : base(position) { diff --git a/ZoFo/GameCore/GameObjects/Entities/Interactables/Door.cs b/ZoFo/GameCore/GameObjects/Entities/Interactables/Door.cs new file mode 100644 index 0000000..06bdec5 --- /dev/null +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Door.cs @@ -0,0 +1,8 @@ +namespace ZoFo.GameCore.GameObjects.Entities.Interactables; + +public class Door +{ + public bool isOpened; + + +} \ No newline at end of file diff --git a/ZoFo/GameCore/GameObjects/Entities/Interactables/Interactable.cs b/ZoFo/GameCore/GameObjects/Entities/Interactables/Interactable.cs new file mode 100644 index 0000000..6299155 --- /dev/null +++ b/ZoFo/GameCore/GameObjects/Entities/Interactables/Interactable.cs @@ -0,0 +1,26 @@ +using Microsoft.Xna.Framework; +using ZoFo.GameCore.GameManagers; +using ZoFo.GameCore.GameManagers.CollisionManager; +using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient; +using ZoFo.GameCore.GameObjects.Entities.LivingEntities.Player; + +namespace ZoFo.GameCore.GameObjects.Entities.Interactables; + +public class Interactable : Entity +{ + public Interactable(Vector2 position) : base(position) + { + collisionComponent.OnTriggerEnter += (sender, e) => ChangeInteraction(sender, e, true); + collisionComponent.OnTriggerExit += (sender, e) => ChangeInteraction(sender, e, false); + } + + private void ChangeInteraction(object sender, CollisionComponent e, bool isReady) + { + AppManager.Instance.server.AddData(new UpdateInteractionReady((sender as Player).Id, isReady)); + } + + public void OnInteraction() + { + + } +} \ No newline at end of file diff --git a/ZoFo/GameCore/GameObjects/GameObject.cs b/ZoFo/GameCore/GameObjects/GameObject.cs index 23b5372..14c306f 100644 --- a/ZoFo/GameCore/GameObjects/GameObject.cs +++ b/ZoFo/GameCore/GameObjects/GameObject.cs @@ -12,7 +12,6 @@ public abstract class GameObject { public Vector2 position; - private Server server; public Vector2 rotation; //вектор направления объекта public abstract GraphicsComponent graphicsComponent { get; }