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

@ -47,12 +47,15 @@ namespace ZoFo.GameCore
// Отправляются данные апдейтса с обновлением инпута
AppManager.Instance.InputManager.ActionEvent += () =>
{
networkManager.AddData(new UpdateInput()
if (AppManager.Instance.client.networkManager.PlayerId > 0)
{
InputMovementDirection = AppManager.Instance.InputManager.InputMovementDirection.Serialize(),
InputAttackDirection = AppManager.Instance.InputManager.InputAttackDirection.Serialize(),
PlayerId = AppManager.Instance.client.networkManager.PlayerId
});
networkManager.AddData(new UpdateInput()
{
InputMovementDirection = AppManager.Instance.InputManager.InputMovementDirection.Serialize(),
InputAttackDirection = AppManager.Instance.InputManager.InputAttackDirection.Serialize(),
PlayerId = AppManager.Instance.client.networkManager.PlayerId
});
}
};
AppManager.Instance.InputManager.OnInteract += () =>

View file

@ -170,6 +170,10 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
update = token.ToObject<UpdateTileCreated>();
data.Add(update);
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(UpdateInputInteraction))]
[JsonDerivedType(typeof(UpdateInputShoot))]
[JsonDerivedType(typeof(UpdateCreatePlayer))]
public class UpdateData
{