mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-18 13:23:05 +00:00
36 lines
876 B
C#
36 lines
876 B
C#
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using QSB.Messaging;
|
|||
|
using QSB.TransformSync;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.Networking;
|
|||
|
|
|||
|
namespace QSB.Events
|
|||
|
{
|
|||
|
class GameState : NetworkBehaviour
|
|||
|
{
|
|||
|
private MessageHandler<FullStateMessage> _messageHandler;
|
|||
|
|
|||
|
private void Awake()
|
|||
|
{
|
|||
|
_messageHandler = new MessageHandler<FullStateMessage>();
|
|||
|
_messageHandler.OnClientReceiveMessage += OnClientReceiveMessage;
|
|||
|
}
|
|||
|
|
|||
|
private void OnClientReceiveMessage(FullStateMessage message)
|
|||
|
{
|
|||
|
PlayerJoin.PlayerNames = message.PlayerNames;
|
|||
|
}
|
|||
|
|
|||
|
public void Send()
|
|||
|
{
|
|||
|
var message = new FullStateMessage()
|
|||
|
{
|
|||
|
PlayerNames = PlayerJoin.PlayerNames
|
|||
|
};
|
|||
|
|
|||
|
_messageHandler.SendToAll(message);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|