コード例 #1
0
        protected override void OnServerReceivedMessageRaw(byte[] data, ulong steamID)
        {
            MessageMove message = ByteSerializer.FromBytes <MessageMove>(data);

            horizontalInput = message.horizontalInput;
            verticalInput   = message.verticalInput;
            jump            = message.jump;

            if (jump)
            {
                Vector3 jumpForce = jumpHeight * Vector3.up;
                GetComponent <Rigidbody>().AddForce(jumpForce, ForceMode.VelocityChange);
            }
        }
コード例 #2
0
        protected override void OnServerReceivedMessageRaw(byte[] data, ulong steamID)
        {
            MessageExpandSplit message = ByteSerializer.FromBytes <MessageExpandSplit>(data);

            if (message.expand)
            {
                transform.localScale += Vector3.one;
            }
            else
            {
                // Make smaller and duplicate this object
                transform.localScale *= 0.5f;

                // Duplicate the object on the server scene
                Scene previouslyActiveScene = SceneManager.GetActiveScene();
                SceneManager.SetActiveScene(GameServer.Instance.gameObject.scene);
                Instantiate(gameObject, transform.parent, true);
                SceneManager.SetActiveScene(previouslyActiveScene);
            }
        }
コード例 #3
0
    void OnMessageNetworkBehaviourInitialized(byte[] data, ulong steamID)
    {
        MessageNetworkBehaviourInitialized message = ByteSerializer.FromBytes <MessageNetworkBehaviourInitialized>(data);

        networkObjects[message.networkID].HandleNetworkBehaviourInitializedMessage(message.index, steamID);
    }