// Function OnTriggerEnter : Now Is Use for get Hurt Animation //Method: This is use for getting the Animation of Get Hurt Animation; private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("EnemyWeapon")) { if (this.gameObject.tag == FrontHitString && other.gameObject) { BackHitAttention.SetActive(false); LeftHitAttention.SetActive(false); RightHitAttention.SetActive(false); _PlayerCtrl.BtnHitCount = 0; StartCoroutine("FrontSetActiveturnBackTotrue"); if (!isGetHurtPlayer) { GlobalPlayerStatement._INSTANCE.Life--; Debug.Log("Player's Life" + GlobalPlayerStatement._INSTANCE.Life); _PlayerCtrl._anim.SetTrigger(hitFrontAnim); _PlayerCtrl.HitDetection(); isGetHurtPlayer = true; StartCoroutine("TurnBackToFalse"); _PlayerCtrl.playerstates = MainChracterCtrl.PLAYERSTATE.PlayerState_GetHit; } } else if (this.gameObject.tag == BackHitString && other.gameObject) { _PlayerCtrl.BtnHitCount = 0; FrontHitAttention.SetActive(false); LeftHitAttention.SetActive(false); RightHitAttention.SetActive(false); StartCoroutine("BackSetActiveturnBackTotrue"); if (!isGetHurtPlayer) { GlobalPlayerStatement._INSTANCE.Life--; Debug.Log("Player's Life" + GlobalPlayerStatement._INSTANCE.Life); _PlayerCtrl._anim.SetTrigger(backFrontAnim); isGetHurtPlayer = true; _PlayerCtrl.HitDetection(); StartCoroutine("TurnBackToFalse"); _PlayerCtrl.playerstates = MainChracterCtrl.PLAYERSTATE.PlayerState_GetHit; } } else if (this.gameObject.tag == LeftHitString && other.gameObject) { _PlayerCtrl.BtnHitCount = 0; FrontHitAttention.SetActive(false); BackHitAttention.SetActive(false); RightHitAttention.SetActive(false); StartCoroutine("LeftSetActiveturnBackTotrue"); // _PlayerCtrl.HitDetection(); if (!isGetHurtPlayer) { GlobalPlayerStatement._INSTANCE.Life--; Debug.Log("Player's Life" + GlobalPlayerStatement._INSTANCE.Life); _PlayerCtrl._anim.SetTrigger(HitLeftAnim); isGetHurtPlayer = true; _PlayerCtrl.HitDetection(); StartCoroutine("TurnBackToFalse"); _PlayerCtrl.playerstates = MainChracterCtrl.PLAYERSTATE.PlayerState_GetHit; } } else if (this.gameObject.tag == RightHitString && other.gameObject) { _PlayerCtrl.BtnHitCount = 0; FrontHitAttention.SetActive(false); BackHitAttention.SetActive(false); LeftHitAttention.SetActive(false); StartCoroutine("RightSetActiveturnBackTotrue"); if (!isGetHurtPlayer) { GlobalPlayerStatement._INSTANCE.Life--; Debug.Log("Player's Life" + GlobalPlayerStatement._INSTANCE.Life); _PlayerCtrl._anim.SetTrigger(HitRightAnim); isGetHurtPlayer = true; _PlayerCtrl.HitDetection(); StartCoroutine("TurnBackToFalse"); _PlayerCtrl.playerstates = MainChracterCtrl.PLAYERSTATE.PlayerState_GetHit; } } } if (other.gameObject.CompareTag("PlayerWeapon")) { if (this.gameObject.CompareTag("EnemyHit") && other.gameObject) { Debug.Log("Enemy Get Hit"); _EnemyCtrl.EnemyHurt(); } } }