Ejemplo n.º 1
0
        /// <summary>
        /// Helper method that wraps sending of the Live State update and logging of this action.
        /// </summary>
        private void SendReverseMetadata(string map, string mode, string type)
        {
            LogWithTimestamp(string.Format("Sending <b>Rreverse metadata</b>: map = {0}, mode = {1}, " +
                                           "type = {2}",
                                           map, mode, type));

            // It is safe to call this every frame if it is easier to do so - the values are only
            // sent to the Agent if they have changed.
            // The final parameter can be used to send additional custom key/value pairs.
            server.SendReverseMetadata(map, mode, type);
        }
    private IEnumerator Simulation()
    {
        yield return(new WaitUntil(() => server.Status == OneServerStatus.OneServerStatusReady));

        server.SetApplicationInstanceStatus(OneApplicationInstanceStatus.OneServerOnline);

        while (true)
        {
            server.SetLiveState(UnityEngine.Random.Range(0, 101), 100, "Test", "Test", "Test", "v0.1", null);
            server.SendReverseMetadata("Example map", "Example mode", "example type");

            if (++_stateSentCount % 10000 == 0)
            {
                Debug.LogFormat("State sent messages: {0}", _stateSentCount);
            }

            yield return(null);
        }
    }