From ff7d89aae01d432167822dafee06611b80799142 Mon Sep 17 00:00:00 2001 From: AnloGames <7383an@gmail.com> Date: Tue, 20 Aug 2024 17:20:45 +0300 Subject: [PATCH 1/2] ClientMPFix --- ZoFo/GameCore/GameObjects/Entities/Entity.cs | 5 ++++- ZoFo/GameCore/GameObjects/GameObject.cs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ZoFo/GameCore/GameObjects/Entities/Entity.cs b/ZoFo/GameCore/GameObjects/Entities/Entity.cs index 97630bf..fc7cea8 100644 --- a/ZoFo/GameCore/GameObjects/Entities/Entity.cs +++ b/ZoFo/GameCore/GameObjects/Entities/Entity.cs @@ -59,7 +59,10 @@ namespace ZoFo.GameCore.GameObjects public virtual void Delete() { - AppManager.Instance.server.DeleteObject(this); + if (AppManager.Instance.gamestate == GameState.HostPlaying) + { + AppManager.Instance.server.DeleteObject(this); + } } } } diff --git a/ZoFo/GameCore/GameObjects/GameObject.cs b/ZoFo/GameCore/GameObjects/GameObject.cs index 335d042..d4472b6 100644 --- a/ZoFo/GameCore/GameObjects/GameObject.cs +++ b/ZoFo/GameCore/GameObjects/GameObject.cs @@ -43,7 +43,10 @@ public abstract class GameObject public void Instantiate(GameObject gameObject) { - AppManager.Instance.server.RegisterGameObject(gameObject); + if (AppManager.Instance.gamestate == GameState.HostPlaying) + { + AppManager.Instance.server.RegisterGameObject(gameObject); + } } #endregion From 09ecf63c8007729675f8bbb5ef54d1ce79e2d0b6 Mon Sep 17 00:00:00 2001 From: AnloGames <7383an@gmail.com> Date: Tue, 20 Aug 2024 17:36:45 +0300 Subject: [PATCH 2/2] AddTodoToAddDifferentPlayers --- ZoFo/GameCore/Client.cs | 1 + .../Updates/ServerToClient/UpdateGameObjectDeleted.cs | 2 +- ZoFo/GameCore/Server.cs | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ZoFo/GameCore/Client.cs b/ZoFo/GameCore/Client.cs index 5d054b3..ff0a36b 100644 --- a/ZoFo/GameCore/Client.cs +++ b/ZoFo/GameCore/Client.cs @@ -197,6 +197,7 @@ namespace ZoFo.GameCore } else if (update is UpdateGameObjectCreated) { + //TODO Entity created_gameObject; if ((update as UpdateGameObjectCreated).GameObjectType == "Player") { diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameObjectDeleted.cs b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameObjectDeleted.cs index d149be8..121e8df 100644 --- a/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameObjectDeleted.cs +++ b/ZoFo/GameCore/GameManagers/NetworkManager/Updates/ServerToClient/UpdateGameObjectDeleted.cs @@ -12,6 +12,6 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient public class UpdateGameObjectDeleted : UpdateData { public UpdateGameObjectDeleted() { UpdateType = "UpdateGameObjectDeleted"; isImportant = false; } - public string GameObjectType; + public string GameObjectType { get; set; } } } \ No newline at end of file diff --git a/ZoFo/GameCore/Server.cs b/ZoFo/GameCore/Server.cs index 7701e87..3cd8532 100644 --- a/ZoFo/GameCore/Server.cs +++ b/ZoFo/GameCore/Server.cs @@ -123,6 +123,7 @@ namespace ZoFo.GameCore networkManager.StartGame(); new MapManager().LoadMap(); + //TODO //AppManager.Instance.server.RegisterGameObject(new EntittyForAnimationTests(new Vector2(0, 0))); AppManager.Instance.server.RegisterGameObject(new Player(new Vector2(760, 140))); //for (int i = 0; i < 20; i++)