//Deal Damage void DealDamage(PlayerHealth hp) { if (hp) { hp.DealDamage((int)Damage); player.playerState = PlayerState.Combat; player.CheckForExitCombat(); } }
void DealDamage(Transform target) { Health hp = (Health)target.transform.GetComponent("Health"); if (hp) { GameObject dmgTxt = (GameObject)Instantiate(globalPrefabs.floatingDamageText); dmgTxt.transform.parent = target; FloatingTextGUI ftg = dmgTxt.GetComponent <FloatingTextGUI>(); ftg.SetDmgInfo("", target.position); MonsterAI fa = (MonsterAI)target.GetComponent <MonsterAI>(); physicalDamageDealt = 0; int DamageDealt = CalculateWeaponDamage(ftg, fa); ProcHandler(fa); fa.inCombat = true; hp.CurrentHealth = hp.CurrentHealth - Damage; playerNew.playerState = PlayerState.Combat; playerNew.CheckForExitCombat(); } }