Example #1
0
 // Use this for initialization
 void Start()
 {
     netID       = GetComponent <NetworkIdentity>();
     onb         = GetComponent <OnGrabbedBehaviour>();
     requestAuth = new List <NetworkConnection>();
     releaseAuth = new List <NetworkConnection>();
 }
Example #2
0
 // Use this for initialization
 void Start()
 {
     if ((localPlayer = GameObject.FindGameObjectWithTag("vive")) != null)
     {
         Transform tr = null;
         if ((tr = localPlayer.transform.Find("Player")) != null)
         {
             localActor = tr.gameObject.GetComponent <Actor>();
         }
     }
     if ((localPlayer = GameObject.FindGameObjectWithTag("leap")) != null)
     {
         Transform tr = null;
         if ((tr = localPlayer.transform.Find("Player")) != null)
         {
             localActor = tr.gameObject.GetComponent <Actor>();
         }
     }
     if ((netID = GetComponent <NetworkIdentity>()) == null)
     {
         Debug.LogError("netID is NULL in AuthorityManager");
     }
     if ((onb = GetComponent <OnGrabbedBehaviour>()) == null)
     {
         Debug.LogError("onb is NULL in AuthorityManager");
     }
     if ((onGrabbedBehaviour = GetComponent <OnGrabbedBehaviour>()) == null)
     {
         Debug.LogError("onGrabbedBehaviour is NULL in OnGrabbedBehaviour");
     }
 }
    OnGrabbedBehaviour onb; // component defining the behaviour of this GO when it is grabbed by a player
                            // this component can implement different functionality for different GO´s


    //***************************************************************************************************

    // these variables should be set up on the server

    // TODO: implement a mechanism for storing consequent authority requests from different clients
    // e.g. manage a situation where a client requests authority over an object that is currently being manipulated by another client

    //*****************************************************************************************************

    // TODO: avoid sending two or more consecutive RemoveClientAuthority or AssignClientAUthority commands for the same client and shared object
    // a mechanism preventing such situations can be implemented either on the client or on the server

    // Use this for initialization
    void Start()
    {
        netID = this.gameObject.GetComponent <NetworkIdentity>();
        onb   = this.gameObject.AddComponent <OnGrabbedBehaviour>();
    }