/// <summary> /// Handles how the player attacks. /// </summary> /// <returns></returns> public virtual void Attack() { if (couldAttack && !GameController_v7.Instance.GetDialogueManager().IsDialogueBoxPlaying()) { #if UNITY_STANDALONE if (this.hasNeedle && this.usingNeedle) { needleThrowing.Throw(Camera.main.ScreenToWorldPoint(Input.mousePosition)); } else if (this.hasHammer && this.usingHammer /*&& this.hammerAnimator.GetCurrentAnimatorStateInfo(0).IsName("Hammer Stay")*/) { hammerAttack.HammerSmash(); } #elif UNITY_ANDROID if (this.hasNeedle && this.usingNeedle) { if (!isMobileButtonClicked()) { needleThrowing.Throw(Camera.main.ScreenToWorldPoint(Input.mousePosition)); } } else if (this.hasHammer && this.usingHammer) { if (!isMobileButtonClicked()) { hammerAttack.HammerSmash(); } } #endif } }
// public bool isMobileButtonClicked() { // GameObject selectedGameObject = EventSystem.current.currentSelectedGameObject; // if (selectedGameObject == null) // return true; // else { // if (selectedGameObject.tag != "MobileButton") // return true; // return false; // } // } public void Needle() { AudioSource.PlayClipAtPoint(sfxFire, transform.position); attackingAnimation(); needleThrowing.Throw(Input.mousePosition); }