public void Attack(CharacterStat targetStats) { if (attackCooldowm <= 0f) { targetStats.TakeDamage(myStats.damage.GetValue()); attackCooldowm = 1f / attackSpeed; } }
public void AttackHit_AnimationEvent() { opponentStats.TakeDamage(myStats.damage.GetValue()); if (opponentStats.currentHealth <= 0) { InCombat = false; } }
public static void ProcessDamage(CharacterStat from, CharacterStat to, float damage) { to.TakeDamage(from, damage); if (from.isPlayer) { from.lastHitBy = to; if (from.lastHitBy._hp <= 0) { from.lastHitBy = null; } } }
public static void ProcessDamage(CharacterStat from, CharacterStat to) { float finalDamage = CalcDamage(from, to); to.TakeDamage(from, finalDamage); }
IEnumerator DoDamage(CharacterStat stats, float delay) { yield return(new WaitForSeconds(delay)); stats.TakeDamage(myStats.damage.GetValue()); }
private void OnTriggerEnter(Collider other) { if (!isDead) { if (opponentObjAtkTagName == null) { Debug.LogError("WeaponTag Name is null"); } if (other.tag == opponentObjAtkTagName) { float weaponDamage = other.gameObject.GetComponent <NeedWeaponThingsForSystem>().Damage; CharacterStat objStat = this.gameObject.GetComponent <CharacterStat>(); WeaponMeshCtrl meshCtrl = other.GetComponent <WeaponMeshCtrl>(); //Weapon의 메쉬일 경우 if (meshCtrl.IsWeaponMesh) { Weapon weapon = null; if (meshCtrl) { weapon = meshCtrl.WeaponGameObject; } else { weapon = other.GetComponent <ProjectileCtrl>().WeaponGameObject; } Vector3 newPos = tr.position; newPos.y += 1f; // Paticle Instantiate(ParticleMng.GetInstance().EffectBulletImpactWood(), newPos, tr.rotation); Instantiate(ParticleMng.GetInstance().EffectBulletImpactMetal(), newPos, tr.rotation); if (weapon.listSoundName.Capacity > 0) { int rand = Random.Range(0, weapon.listSoundName.Count); AudioMng.GetInstance().PlaySound(weapon.listSoundName[rand], this.transform.position, 120f); } if (!isAttacked && meshCtrl) { isAttacked = true; weapon.SubtractDurability(); } // Combo ComboSystemMng.GetInstance().AddCombo(50f); // Taking Damage objStat.TakeDamage(weaponDamage); } //노멀 어택의 메쉬인 경우 else { NormalAtkCtrl normalAtkCtrl = other.GetComponent <NormalAtkCtrl>(); Vector3 newPos = tr.position; newPos.y += 1f; // Paticle Instantiate(ParticleMng.GetInstance().EffectBulletImpactWood(), newPos, tr.rotation); Instantiate(ParticleMng.GetInstance().EffectBulletImpactMetal(), newPos, tr.rotation); //경훈이가 만들었는데 사운드 부분이여서 일단 자름 //if (normalAtkCtrl.listSoundName.Capacity > 0) //{ // int rand = Random.Range(0, normalAtkCtrl.listSoundName.Count); // AudioMng.GetInstance().PlaySound(normalAtkCtrl.listSoundName[rand], this.transform.position, 120f); //} if (!isAttacked) { isAttacked = true; } // Combo ComboSystemMng.GetInstance().AddCombo(50f); // Taking Damage objStat.TakeDamage(weaponDamage); } } } }
public static void ProcessDamage(CharacterStat from, CharacterStat to, int damage) { float finalDamage = damage; to.TakeDamage(from, finalDamage); }