public void Update() { if (Input.GetMouseButtonDown(0)) { GameObject selectedObject = Select(); objManager.RequestOwnership(selectedObject); } if (Input.GetMouseButtonDown(1)) { string prefabName = "Sphere"; Vector3 position = new Vector3(0, 0, 2); Quaternion rotation = Quaternion.identity; Vector3 scale = Vector3.one; //objManager.Instantiate(prefabName, position, rotation, scale); //GameObject go = objManager.Instantiate(prefabName); GameObject go = objManager.InstantiateOwnedObject(prefabName); go.transform.Translate(position); UWBNetworkingPackage.NetworkManager nm = GameObject.Find("NetworkManager").GetComponent <UWBNetworkingPackage.NetworkManager>(); List <int> IDsToAdd = new List <int>(); IDsToAdd.Add(2); nm.WhiteListOwnership(go, IDsToAdd); //nm.RestrictOwnership(go, IDsToAdd); } }
// Update is called once per frame void Update() { if (Input.GetKey(KeyCode.DownArrow) || Input.GetKey(KeyCode.S)) { MoveBehavior.Down(); } if (Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.W)) { MoveBehavior.Up(); } if (Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.A)) { MoveBehavior.Left(); } if (Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.D)) { MoveBehavior.Right(); } if (Input.GetKeyDown(KeyCode.Q)) { MoveBehavior.RotateClockwise(); } if (Input.GetKeyDown(KeyCode.E)) { MoveBehavior.RotateCounterClockwise(); } if (Input.GetKey(KeyCode.R)) { //gameObject.GetComponent<CreateObject>().CreatePUNObject("Rooms/Room2/Room2"); string prefabName = "Rooms/Room2/Room2"; //objManager.Instantiate(prefabName); objManager.InstantiateOwnedObject(prefabName); } if (Input.GetKey(KeyCode.P)) { GameObject go = GameObject.Find("Sphere"); UWBNetworkingPackage.NetworkManager nm = GameObject.Find("NetworkManager").GetComponent <UWBNetworkingPackage.NetworkManager>(); nm.UnRestrictOwnership(go); } if (Input.GetKey(KeyCode.O)) { List <int> IDsToAdd = new List <int>(); IDsToAdd.Add(2); UWBNetworkingPackage.NetworkManager nm = GameObject.Find("NetworkManager").GetComponent <UWBNetworkingPackage.NetworkManager>(); GameObject go = GameObject.Find("Sphere"); nm.WhiteListOwnership(go, IDsToAdd); } }