void OnShoot(ClientInputState input) { Debug.Log("Got Shoot Request"); if (turnManager.CurrentTurn() == playerId) { turnManager.ConsumeTurn(); } }
void Start() { t = transform; if (isLocalPlayer) { m_Driver = new UdpCNetworkDriver(new INetworkParameter[0]); m_Connection = default(NetworkConnection); var endpoint = new IPEndPoint(SelectConnection.address, 9000); m_Connection = m_Driver.Connect(endpoint); inputState = new ClientInputState(); repository = new ObjectRepository(); } }
public byte[] ConstructClientInputState(ClientMessageType type, ushort clientId, uint tick, Vector3 desiredMove, bool isTurbo) { fbBuilder.Clear(); ClientInputState.StartClientInputState(fbBuilder); ClientInputState.AddTick(fbBuilder, tick); ClientInputState.AddDesiredMove(fbBuilder, Vec2.CreateVec2(fbBuilder, desiredMove.x, desiredMove.y)); ClientInputState.AddIsTurbo(fbBuilder, isTurbo); Offset <ClientInputState> clientInputStateOffset = ClientInputState.EndClientInputState(fbBuilder); ClientMessage.StartClientMessage(fbBuilder); //var clientIdOffset = clientId; ClientMessage.AddClientId(fbBuilder, clientId); ClientMessage.AddMsgType(fbBuilder, type); ClientMessage.AddMsg(fbBuilder, clientInputStateOffset.Value); Offset <ClientMessage> clientMessageOffset = ClientMessage.EndClientMessage(fbBuilder); ClientMessage.FinishClientMessageBuffer(fbBuilder, clientMessageOffset); return(fbBuilder.SizedByteArray()); }