void AcceptInput() { if (!animationManager.CheckAnimationsPlaying()) { boardSquare square = inputManager.GetSquareOnClick(); if (square != null) { square.GemScript.DestroyGem(); } } }
bool AcceptInput() { if (!animationManager.CheckAnimationsPlaying()) { boardSquare square = inputManager.GetInput(); if (square != null) { //Debug.Log("Trying to boom"); square.DestroyGem(false); return(true); } } return(false); }
//Methods public boardSquare GetSquareOnClick() { if (Input.GetMouseButtonDown(0) && !animationManager.CheckAnimationsPlaying()) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 100)) { if (hit.transform.gameObject != null) { return(hit.transform.gameObject.GetComponent <boardSquare>()); } } } return(null); }
boardSquare GetSquareOnClick() //Windows & Editor { if (Input.GetMouseButtonUp(0) && !animationManager.CheckAnimationsPlaying()) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 100)) { if (hit.transform.gameObject != null) { boardSquare square = hit.transform.gameObject.GetComponent <boardSquare>(); if (square != null && !square.isStaticSquare && square.Gem.activeSelf) { return(square); } } } } return(null); }