SettingmultiplyPlayers in solo

This commit is contained in:
AnloGames 2024-08-20 18:42:08 +03:00
parent 4dc18ea64e
commit 29a7648e5b
3 changed files with 13 additions and 5 deletions

View file

@ -46,6 +46,8 @@ namespace ZoFo.GameCore
// Подписка на действия инпутменеджера. // Подписка на действия инпутменеджера.
// Отправляются данные апдейтса с обновлением инпута // Отправляются данные апдейтса с обновлением инпута
AppManager.Instance.InputManager.ActionEvent += () => AppManager.Instance.InputManager.ActionEvent += () =>
{
if (AppManager.Instance.client.networkManager.PlayerId > 0)
{ {
networkManager.AddData(new UpdateInput() networkManager.AddData(new UpdateInput()
{ {
@ -53,6 +55,7 @@ namespace ZoFo.GameCore
InputAttackDirection = AppManager.Instance.InputManager.InputAttackDirection.Serialize(), InputAttackDirection = AppManager.Instance.InputManager.InputAttackDirection.Serialize(),
PlayerId = AppManager.Instance.client.networkManager.PlayerId PlayerId = AppManager.Instance.client.networkManager.PlayerId
}); });
}
}; };
AppManager.Instance.InputManager.OnInteract += () => AppManager.Instance.InputManager.OnInteract += () =>

View file

@ -170,6 +170,10 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
update = token.ToObject<UpdateTileCreated>(); update = token.ToObject<UpdateTileCreated>();
data.Add(update); data.Add(update);
break; break;
case "UpdateCreatePlayer":
update = token.ToObject<UpdateCreatePlayer>();
data.Add(update);
break;
} }
} }

View file

@ -27,6 +27,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates
[JsonDerivedType(typeof(UpdatePlayerExit))] [JsonDerivedType(typeof(UpdatePlayerExit))]
[JsonDerivedType(typeof(UpdateInputInteraction))] [JsonDerivedType(typeof(UpdateInputInteraction))]
[JsonDerivedType(typeof(UpdateInputShoot))] [JsonDerivedType(typeof(UpdateInputShoot))]
[JsonDerivedType(typeof(UpdateCreatePlayer))]
public class UpdateData public class UpdateData
{ {