public void OnTakeDamageEvent(object source, DamageTakenArgs damageArgs) { //Check to see if the health compoent has an active DamageNumber GameObject healthObj = damageArgs.DamageTaker.gameObject; //Cancel if the Health Component's parent has a filtered tag foreach (string filter in FilteredTags) { if (healthObj.tag == filter) { return; } } Health healthComponent = healthObj.GetComponent <Health>(); int PlayerWhoDealtDamageNum = damageArgs.PlayerNum; AIWhichLastTookDamage = healthComponent.gameObject; //Only do this logic for the local player if (PlayerWhoDealtDamageNum != -1) { PlayerWhoLastDealtDamage = PlayerWhoDealtDamageNum; //If the player who dealt the damage is local do the logic if (PlayerWhoDealtDamageNum == m_LocalPlayerRef.PlayerNumber) { //If the Health Component already has a Damage number add to it if (healthComponent.DamageNumber != null) { //Add the damage to the existing Damage Number healthComponent.DamageNumber.AddDamage(damageArgs.Damage); return; } //If the Damage AI does not already have an active Damage number set it else { //Get a DisplayNumber from the pool GameObject obj = ObjectPoolManager.Instance.GetObjectFromOfflinePool(m_DamageNumber); obj.transform.SetParent(transform); obj.SetActive(true); //Set the DisplayNumberPrefab's pos obj.transform.position = healthObj.transform.position; //Set the Damage DamageNumber damageNum = obj.GetComponent <DamageNumber>(); damageNum.AddDamage(damageArgs.Damage, healthComponent, m_LocalPlayerRef, damageArgs.DamageNumberColor); } } } }