Exemple #1
0
        IEnumerator SendInputToServer()
        {
            while (true)
            {
                MessageMove message = new MessageMove(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), false);
                SendToServer(ByteSerializer.GetBytes(message), SendType.Unreliable);

                yield return(new WaitForSecondsRealtime(1.0f / inputsPerSec));
            }
        }
        protected override void UpdateClient()
        {
            if (Input.GetKeyDown(KeyCode.Return))
            {
                MessageExpandSplit message = new MessageExpandSplit(true);
                SendToServer(ByteSerializer.GetBytes(message), SendType.Reliable);
            }

            if (Input.GetKeyDown(KeyCode.Backspace))
            {
                MessageExpandSplit message = new MessageExpandSplit(false);
                SendToServer(ByteSerializer.GetBytes(message), SendType.Reliable);
            }
        }
Exemple #3
0
        protected override void UpdateClient()
        {
            if (Input.GetKeyDown(KeyCode.Space))
            {
                MessageMove message = new MessageMove(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), true);
                SendToServer(ByteSerializer.GetBytes(message), SendType.Reliable);
            }

            if (Input.GetKeyDown(KeyCode.I))
            {
                networkObject.interpolateOnClient = true;
            }

            if (Input.GetKeyDown(KeyCode.O))
            {
                networkObject.interpolateOnClient = false;
            }
        }