public void GetHit(Vector2 direction, int damage, bool isCrit) { if (!mGetHit && !mDying) { mGetHit = true; if (GameObject.Find("Player").GetComponent <Player> ().IsStrongAttack()) { staggerTimer = 25 - (int)(staggerTimer * 0.10f); damage = (int)(damage * 1.4f); if (!strongHit.isPlaying) { strongHit.Play(); } } else { staggerTimer = 15 - (int)(staggerTimer * 0.10f); if (audioTimer >= 0.2f) { normalHit.Play(); audioTimer = 0.0f; } } mStats.TakeDamage(damage); if (isCrit) { uiCanvas.CreateDamageLabel(((int)mStats.DamageDealt(damage)).ToString(), (transform.position + damagePositionOffset), UINotification.TYPE.CRIT); } else { uiCanvas.CreateDamageLabel(((int)mStats.DamageDealt(damage)).ToString(), (transform.position + damagePositionOffset), UINotification.TYPE.HPLOSS); } } }
public void GetHit(Vector2 direction, int damage, bool isCrit) { if (!mGetHit && !mDying) { StartCoroutine(Stagger()); mRigidBody.isKinematic = false; mGetHit = true; mRigidBody.velocity = Vector2.zero; if (GameObject.Find("Player").GetComponent <Player> ().IsStrongAttack()) { staggerTimer = 25f - (staggerTimer * 0.10f); damage = (int)(damage * 1.5f); Recoil(direction, 2f); if (!strongHit.isPlaying) { strongHit.Play(); } } else if (GameObject.Find("Player").GetComponent <Player> ().IsDashing()) { staggerTimer = 28f - (staggerTimer * 0.10f); damage = (int)(damage * 0.35f); Recoil(direction, 2f); if (audioTimer >= 0.2f) { normalHit.Play(); audioTimer = 0.0f; } } else { staggerTimer = 15 - (staggerTimer * 0.10f); Recoil(direction, mPushBack); if (audioTimer >= 0.2f) { normalHit.Play(); audioTimer = 0.0f; } } mStats.TakeDamage(damage); if (isCrit) { uiCanvas.CreateDamageLabel(((int)mStats.DamageDealt(damage)).ToString(), (transform.position + damagePositionOffset), UINotification.TYPE.CRIT); } else { uiCanvas.CreateDamageLabel(((int)mStats.DamageDealt(damage)).ToString(), (transform.position + damagePositionOffset), UINotification.TYPE.HPLOSS); } } }
public void GetHit(Vector2 direction, int damage) { if (!mGetHit && !mGetKnockdown && !mInflate) { mGetHit = true; maxStreak = getNoDamageStreak(); noDamageStreak = 0; mStats.TakeDamage(damage); mHealthBarRef.SetHealth(mStats.Hp); uiCanvas.CreateDamageLabel(((int)mStats.DamageDealt(damage)).ToString(), (transform.position + damagePosition), UINotification.TYPE.HPLOSS); mRigidBody.isKinematic = false; mRigidBody.velocity = Vector3.zero; mRigidBody.AddForce(new Vector2(direction.x, 0.0f) * mHitPushBack, ForceMode.Impulse); } }