void DealMeleeAttackDMG(ObjectController target) { DirectDamage dmg = AutoAttackDamageDeal(target.GetCurrStats(STATSTYPE.DEFENSE)); OC.ON_HEALTH_GAIN += OC.HealHP; OC.ON_HEALTH_GAIN(new HealHP(dmg.Amount * (OC.GetCurrStats(STATSTYPE.LPH) / 100), dmg.Crit, OC, typeof(MeleeAttackCollider))); OC.ON_HEALTH_GAIN -= OC.HealHP; target.ON_DMG_TAKEN += target.DeductHealth; target.ON_DMG_TAKEN(dmg); target.ON_DMG_TAKEN -= target.DeductHealth; if (HitVFX != null) { target.ActiveOneShotVFXParticle(HitVFX); } if (DamageSFXList.Count > 0) { AudioSource.PlayClipAtPoint(DamageSFXList[UnityEngine.Random.Range(0, DamageSFXList.Count)], target.transform.position, GameManager.SFX_Volume); } else if (HitSFX != null) { AudioSource.PlayClipAtPoint(HitSFX, target.transform.position, GameManager.SFX_Volume); } }
public void UpdateHealthBar() { float CurrHealth = OC.GetCurrStats(STATSTYPE.HEALTH); float MaxHealth = OC.GetMaxStats(STATSTYPE.HEALTH); if (CurrHealth / MaxHealth >= 0) { HealthMask.transform.localScale = new Vector2(CurrHealth / MaxHealth, 1);//Moving mask } else { HealthMask.transform.localScale = new Vector2(0, 1);//Moving mask } }
DirectDamage AutoAttackDamageDeal(float TargetDefense) { if (Random.value < (OC.GetCurrStats(STATSTYPE.CRIT_CHANCE) / 100)) { float RawDamage = OC.GetCurrStats(STATSTYPE.DAMAGE) * (OC.GetCurrStats(STATSTYPE.CRIT_DMG) / 100); return(new DirectDamage(RawDamage, TargetDefense, OC.GetCurrStats(STATSTYPE.PENETRATION), true, OC, typeof(MeleeAttackCollider))); } else { return(new DirectDamage(OC.GetCurrStats(STATSTYPE.DAMAGE), TargetDefense, OC.GetCurrStats(STATSTYPE.PENETRATION), false, OC, typeof(MeleeAttackCollider))); } }