public override void OnReadyNewPlayer()
        {
            Debug.Log("OnReadyNewPlayer");

            var prefab = (GameObject)Resources.Load("Cube");
            foreach (var p in OpenRelayClient.PlayerList.OrderBy(p => p.ID))
            {
                // プレハブからインスタンスを生成
                var transform = GetCradle(p.ID);
                var c = UnityEngine.Object.Instantiate(prefab, transform.position, Quaternion.identity);
                var cube = c.GetComponent<Cube>();
                cubeList.TryAdd(p.ID.ToString(), c);
                if (p.ID == OpenRelayClient.Player.ID)
                {
                    currentObjectId = OpenRelayClient.AllocateObjectId();
                    cube.Initialize(true, (UInt16)p.ID, autoRolling);
                    cube.SwitchVoice(useVoice);
                    var micorophoneIndex = 0;
                    if (useVoice) c.GetComponent<VoiceRecorder>().StartRecorder((UInt16)p.ID, 2, micorophoneIndex);
                }
                else
                {
                    cube.Initialize(false, (UInt16)p.ID, false);
                    cube.SwitchVoice(useVoice);
                    if (useVoice) c.GetComponent<VoicePlayer>().StartPlayer((UInt16)p.ID, 2);
                }
                c.SetActive(true);
            }

            OpenRelayClient.IsMessageQueueRunning = true;
            StartCoroutine(CallSyncHeartbeat());
        }
Пример #2
0
        public override void OnReadyNewPlayer()
        {
            Debug.Log("OnReadyNewPlayer");

            var prefab = (GameObject)Resources.Load("Cube");

            foreach (var p in OpenRelayClient.PlayerList)
            {
                // プレハブからインスタンスを生成
                var c = UnityEngine.Object.Instantiate(prefab, new Vector3(-7f + p.ID, 0f, 1f + p.ID), Quaternion.identity);
                if (p.ID == OpenRelayClient.Player.ID)
                {
                    currentObjectId = OpenRelayClient.AllocateObjectId();
                    c.GetComponent <VoiceRecorder>().StartRecorder((UInt16)p.ID, 1);
                }
                else
                {
                    c.GetComponent <VoicePlayer>().StartPlayer((UInt16)p.ID, 1);
                }
                cubeList.TryAdd(p.ID.ToString(), c);
                c.SetActive(true);
            }

            OpenRelayClient.IsMessageQueueRunning = true;
            StartCoroutine(CallRaiseEvent());
        }