//usesmousemenu private void createMouse(ArrayList playerList) { GameObject newObject = (GameObject)GameObject.Instantiate(mouseController, Vector3.zero, Quaternion.identity); newObject.name = "MouseInput"; mouseControllerRef = newObject.GetComponent<MouseInput>(); mouseControllerRef.players = playerList; int mouseCount = 0; foreach (PlayerInfo o in playerList) { if (!o.usesJoystick) { mouseCount++; } } mouseControllerRef.singleMouse = (mouseCount <= 1 && miceController == null); mouseControllerRef.SetUpRound(); mouseControllerRef.Init(miceController); //If we don't check, the game will so single mouse if we have multi mouse enabled but only one mouse player if (miceController == null) miceController = mouseControllerRef.mousedriver; }
public void Init(RawMouseDriver.RawMouseDriver raw) { if (GameObject.FindObjectsOfType<MouseInput>().Length > 1) { //if this instanced and there is another open, delete the other Destroy(this.gameObject); } else { //pointers = new Transform[4]; lastReticle = new Vector2[4]; mousePosition = new Vector2[NUM_MICE]; lastMousePosition = new Vector2[NUM_MICE]; Cursor.visible = false; if (!singleMouse) { //set up multiple mice unityWindow = (IntPtr)GetActiveWindow(); // foreach (GameObject g in GameObject.FindGameObjectsWithTag("Player")) print(g); //print(playerCount); if (usesMouse) { print("new mouse"); if (raw != null) { mousedriver = raw; } else { mousedriver = new RawMouseDriver.RawMouseDriver(); } mice = new RawMouse[NUM_MICE]; } } } //menuPointersOn = true; init = true; }
public void turnOnMouse() { if (!mousePressed) { if (miceController == null) { mousePressed = true; mouseInfo.SetActive(true); } else { /*print("restarting"); miceController.Dispose(); miceController = new RawMouseDriver.RawMouseDriver(); mouseInfo.SetActive(false);*/ } } else { if (miceController == null) { miceController = new RawMouseDriver.RawMouseDriver(); mouseInfo.SetActive(false); GameObject.Find("EnableMice").transform.FindChild("Text").GetComponent<Text>().text = "Multi-mouse\nsupport enabled"; mousePressed = false; } else { } } }