コード例 #1
0
ファイル: Touching.cs プロジェクト: e08330864/VRARproject
    void Start()
    {
        if (GameObject.Find("Leap") != null)
        {
            leapGrab = FindObjectOfType <LeapGrab>();
        }

        if (GameObject.Find("VIVE") != null)
        {
            viveGrab = FindObjectOfType <ViveGrab>();
        }

        if (GameObject.Find("ArdManager") != null)
        {
            ardManager = FindObjectOfType <ArdManager>();
        }
    }
コード例 #2
0
ファイル: Actor.cs プロジェクト: e08330864/VRARproject
    // Use this for initialization
    void Start()
    {
        if (isServer || isLocalPlayer)
        {
            if (isLocalPlayer)
            {
                // Inform the local player about his new character
                LocalPlayerController.Singleton.SetActor(this);
                CmdInitialize(prefabNameHand);
                CmdInitialize(prefabNameFoot);
                if (GameObject.Find("ArdManager") != null)
                {
                    ardManager = FindObjectOfType <ArdManager>();
                    if (ardManager != null)
                    {
                        coroutine  = SendPositionToArduino();
                        cameraVive = GameObject.FindGameObjectWithTag("cameraVive");
                        StartCoroutine(coroutine);
                    }
                }
            }


            //this part is for object sharing
            //*******************************
            if (isServer)
            {
                // find objects that can be manipulated
                // TIPP : you can use a specific tag for all GO's that can be manipulated by players
                foreach (GameObject go in GameObject.FindGameObjectsWithTag("shared"))
                {
                    sharedObjects.Add(go.GetComponent <NetworkIdentity>());
                }
            }
            if (isLocalPlayer)
            {
                // find objects that can be manipulated
                // assign this Actor to the localActor field of the AuthorityManager component of each shared object
                foreach (GameObject go in GameObject.FindGameObjectsWithTag("shared"))
                {
                    sharedObjects.Add(go.GetComponent <NetworkIdentity>());

                    ParametersAuthorityManager paramAuthority = go.GetComponent <ParametersAuthorityManager>();
                    if (paramAuthority != null)
                    {
                        paramAuthority.AssignActor(this);
                    }

                    ViveParamsAuthorityManager viveParamAuthority = go.GetComponent <ViveParamsAuthorityManager>();
                    if (viveParamAuthority != null)
                    {
                        viveParamAuthority.AssignActor(this);
                    }
                }
            }
        }
        else
        {
            // Initialize on startup
            InitializeHands(prefabNameHand);
            InitializeFoot(prefabNameFoot);
        }
    }