public override void removeItemEffectOnPlayer(unitHitbox player) { base.removeItemEffectOnPlayer(player); ShieldEffectControl shieldEff = player.GetComponentInChildren <ShieldEffectControl>(); if (shieldEff == null) { Debug.LogError("Can't remove no " + itemModel.itemName + " on player"); } else { shieldEff.RemoveEffect(); } }
public override void doActionAPI(unitHitbox unitHitbox) { base.doActionAPI(unitHitbox); ShieldEffectControl shieldEff = unitHitbox.GetComponentInChildren <ShieldEffectControl>(); if (shieldEff == null) { shieldEff = Instantiate(shieldEffect, unitHitbox.transform); shieldEff.SetOwnerInstance(unitHitbox); } else { shieldEff.GetMoreItem(); } }
public void takenDamage(int damage, unitHitbox attacker) { // use for instance that have shield ShieldEffectControl shieldEffect = GetComponentInChildren <ShieldEffectControl>(); if (shieldEffect != null && !shieldEffect.isRemoved) { shieldEffect.takeDamage(damage, attacker); return; } //player if (playerCon != null) { playerCon.recivceDamage(damage); } int atdlength = afterTakenDamageList.Count; for (int i = 0; i < atdlength; i++) { if (afterTakenDamageList[i] != null) { afterTakenDamageList[i].doActionATD(damage, attacker); } } // if (isImmortal) { return; } // if (GameManagerPC.Instance != null) { GameManagerPC.Instance.OnPlayerRecieveDamage(id); } hpCurrent -= damage; if (model != null) { StartCoroutine("blink"); } DamageTextControl.instance.CreateDamageText(damage, transform); if (hpRing != null) { hpRing.updateGauge(hpMax, hpCurrent); } if (hpCurrent <= 0) { hpCurrent = 0; } if (hpCurrent <= 0 && !isDeath) { if (isDeath) { return; } isDeath = true; if (attacker != null && attacker.tag == "Player") { deathAction(attacker.id); } else { deathAction(-1); } } // send stat to player if (statContol != null) { statContol.PlayerStatChange(); } }