Ejemplo n.º 1
0
    public void switchMyHead()
    {
        if (switchHead == null)
        {
            switchHead = GetComponent <SwitchHead>();
        }

        if (currentType == EHeadType.Human)
        {
            currentType = EHeadType.Robot;
        }
        else
        {
            currentType = EHeadType.Human;
        }

        switchHead.switchHead(currentType);
    }
Ejemplo n.º 2
0
    public void switchHead(EHeadType type)
    {
        switch (type)
        {
        case EHeadType.Human:
            humanCommponent.enabled = true;
            humanObject.SetActive(true);
            robotComponent.enabled = false;
            robotObject.SetActive(false);

            break;

        case EHeadType.Robot:
            humanCommponent.enabled = false;
            humanObject.SetActive(false);
            robotComponent.enabled = true;
            robotObject.SetActive(true);
            break;
        }
    }
Ejemplo n.º 3
0
    private void oculusLipSyncSolution(PhotonStream stream, PhotonMessageInfo info)
    {
        if (stream.IsWriting)
        {
            stream.SendNext((int)currentType);
            stream.SendNext(morphTarget.smoothAmount);
            stream.SendNext(JsonUtility.ToJson(context.GetCurrentPhonemeFrame()));
        }
        else
        {
            object agoraId = photonView.Owner.CustomProperties["agoraId"];
            if (agoraId != null)
            {
                UDID = uint.Parse(agoraId.ToString());
            }

            //synced head
            EHeadType networkHead = (EHeadType)((int)stream.ReceiveNext());
            if (networkHead != currentType)
            {
                currentType = networkHead;
                switchHead.switchHead(currentType);
            }

            //sync smoothing
            smoothAmount      = (int)stream.ReceiveNext();
            context.Smoothing = smoothAmount;

            //sync lipsync data
            frameData = (string)stream.ReceiveNext();

            OVRLipSync.Frame frame = JsonUtility.FromJson <OVRLipSync.Frame>(frameData);

            if (frame != null)
            {
                if (currentType == EHeadType.Human)
                {
                    morphTarget.SetVisemeToMorphTarget(frame);

                    morphTarget.SetLaughterToMorphTarget(frame);
                }
                else
                {
                    // Perform smoothing here if on original provider
                    if (context.provider == OVRLipSync.ContextProviders.Original)
                    {
                        // Go through the current and old
                        for (int i = 0; i < frame.Visemes.Length; i++)
                        {
                            // Convert 1-100 to old * (0.00 - 0.99)
                            float smoothing = ((smoothAmount - 1) / 100.0f);
                            textureFlip.oldFrame.Visemes[i] =
                                textureFlip.oldFrame.Visemes[i] * smoothing +
                                frame.Visemes[i] * (1.0f - smoothing);
                        }
                    }
                    else
                    {
                        textureFlip.oldFrame.Visemes = frame.Visemes;
                    }

                    textureFlip.SetVisemeToTexture();
                }
            }

            double pan  = GameState.Instance.getPanFromUser(UDID);
            double gain = GameState.Instance.getGainFromUser(UDID);

            //push pan and gain to agora
            if (GameState.Instance.mRtcEngine != null)
            {
                GameState.Instance.mRtcEngine.GetAudioEffectManager().SetRemoteVoicePosition(UDID, pan, gain);
            }
        }
    }