/// <summary> /// Checks the mouse events and calls the respective scenemanager event. /// </summary> void Update() { // Check for mouse input if (Input.GetMouseButtonDown(0)) { // Check what was under mouse down (if anything) List <GameObject> gos = PickGameObjects(Input.mousePosition); // Pass the game object along to the current scene manager (if any) to let it respond if (sceneManager != null && gos.Count != 0) { sceneManager.OnMouseDown(gos[0]); } } else if (Input.GetMouseButton(0)) { // Check what was under mouse down (if anything) List <GameObject> gos = PickGameObjects(Input.mousePosition); // Pass the game object along to the current scene manager (if any) to let it respond if (sceneManager != null && gos.Count != 0) { sceneManager.OnMouseCurrentlyDown(gos[0]); } if (gos.Count == 0) { // Anytime a mouse currently down event misses any gameobject, update applicable lists in scene manager sceneManager.ResetInputStates(MouseEvents.MouseCurrentlyDown); } } else if (Input.GetMouseButtonUp(0)) { // Check what was under mouse down (if anything) List <GameObject> gos = PickGameObjects(Input.mousePosition); // Pass the game object along to the current scene manager (if any) to let it respond if (sceneManager != null && gos.Count != 0) { sceneManager.OnMouseUp(gos[0]); } // Anytime there is a mouse up event, update applicable lists in scene manager sceneManager.ResetInputStates(MouseEvents.MouseUp); } // quit game on exit else if (Input.GetKeyDown(KeyCode.Escape)) { System.Diagnostics.Process.GetCurrentProcess().Kill(); } }
// Mouse Currently Down Event public void OnMouseCurrentlyDown() { sceneManager.OnMouseCurrentlyDown(this); }