diff --git a/DangerousD/GameCore/Network/NetworkTask.cs b/DangerousD/GameCore/Network/NetworkTask.cs index 54fd5b4..a1fb999 100644 --- a/DangerousD/GameCore/Network/NetworkTask.cs +++ b/DangerousD/GameCore/Network/NetworkTask.cs @@ -18,7 +18,6 @@ namespace DangerousD.GameCore.Network public Vector2 velocity { get; set; } public Type type { get; set; } - /// /// Нанести урон сущности /// @@ -83,5 +82,25 @@ namespace DangerousD.GameCore.Network name = StateName; velocity = EntityVelocity; } + + /// + /// Подключается к хосту и передаёт своё имя + /// + /// + public NetworkTask(string PlayerName) + { + operation = NetworkTaskOperationEnum.ConnectToHost; + name = PlayerName; + } + + /// + /// Получает id игрока на клиенте от хоста + /// + /// + public NetworkTask(int PlayerId) + { + operation = NetworkTaskOperationEnum.GetClientPlayerId; + objId = PlayerId; + } } } diff --git a/DangerousD/GameCore/Network/NetworkTaskOperationEnum.cs b/DangerousD/GameCore/Network/NetworkTaskOperationEnum.cs index 49fee15..86cb112 100644 --- a/DangerousD/GameCore/Network/NetworkTaskOperationEnum.cs +++ b/DangerousD/GameCore/Network/NetworkTaskOperationEnum.cs @@ -9,6 +9,6 @@ namespace DangerousD.GameCore.Network [Serializable] public enum NetworkTaskOperationEnum { - TakeDamage, SendSound, CreateEntity, SendPosition, ChangeState + TakeDamage, SendSound, CreateEntity, SendPosition, ChangeState, ConnectToHost, GetClientPlayerId } }