public void HitMole() { RaycastHit hit; if (Physics.Raycast(transform.position, transform.forward, out hit)) { if (hit.transform.GetComponent <Mole_Game1>() != null) { Mole_Game1 mole = hit.transform.GetComponent <Mole_Game1>(); if (mole.transform.localPosition.y > 0.75 * mole.visibleHeight) { GameController.SoundManager.BeatingSound(); mole.Hit(); Hammer.Hit(mole.transform.position); score += 1; GameController.ScoreText.text = "SCORE: " + score; } } } }
public IEnumerator HidingMoles(Mole_Game1 currentMole) { yield return(new WaitForSeconds(Random.Range(2, 3))); currentMole.Hide(); }