public void Impact(Collider other) { if (other.CompareTag("Ability")) { if (spellData.ownerID() == other.GetComponent <SpellData>().ownerID()) { return; } spellData.owner.SendAbilityHit(spellData.InstantiateID(), true, true); spellData.AbilityImpactEffect(); Destroy(this.gameObject); } else if (other.CompareTag("Environmental")) { spellData.owner.SendAbilityHit(spellData.InstantiateID(), true, true); spellData.AbilityImpactEffect(); Destroy(this.gameObject); } else if (other.CompareTag("Player")) { CharacterManager_NET player = other.GetComponent <CharacterManager_NET>(); if (player.m_PhotonView.isMine) { if (player.playerID != spellData.ownerID()) { switch (damageType) { case DamageType.DOT: player.playerHealth().TakeDamageOverTime(amountOfTicks, spellData.damage(), timeBetweenTicks, player, spellData.ownerID()); break; case DamageType.Instant: player.playerHealth().TakeDamage(spellData.damage(), spellData.ownerID(), player, transform, spellData.knockbackForce()); break; case DamageType.None: break; } if (canPush) { Push(other.GetComponent <Rigidbody>(), spellData.knockbackForce(), false); } if (canFreeze) { other.GetComponent <PlayerHealth_NET>().Freeze(spellData.freezeDuration()); } if (canSlow) { other.GetComponent <PlayerMovement>().slowPlayerMovementSpeed(spellData.slowMovementSpeed(), spellData.slowDuration()); } if (canLifeSteal) { spellData.owner.GetComponent <PlayerHealth_NET>().AddLife(spellData.damage() * spellData.lifeStealAmount()); } if (canCurse) { player.playerHealth().Curse(spellData.curseDuration(), spellData.curseDmgAdjuster()); } if (canSwapPos) { Vector3 hitPlayerPos = other.transform.position; spellData.owner.charMananager.SetPlayerPosition(spellData.owner.transform.position, player.playerID); spellData.owner.charMananager.SetPlayerPosition(hitPlayerPos, spellData.ownerID()); } spellData.owner.SendAbilityHit(spellData.InstantiateID(), true, true); if (destroyOnImpact) { Destroy(this.gameObject); } spellData.AbilityImpactEffect(); } else { return; } } } }
public void impactNearbyEnemies(Vector3 origin, bool isDistanceBased, float radius, SpellData spellData) { Collider[] hitCols = Physics.OverlapSphere(origin, radius, mask); if (hitCols.Length > 0) { foreach (Collider col in hitCols) { CharacterManager_NET player = col.GetComponent <CharacterManager_NET>(); if (player.playerID != spellData.ownerID()) { if (player.m_PhotonView.isMine) { if (canPush) { Push(player.GetComponent <Rigidbody>(), false, spellData); } if (canFreeze) { player.playerHealth().Freeze(spellData.freezeDuration()); } if (canCurse) { player.playerHealth().Curse(spellData.curseDuration(), spellData.curseDmgAdjuster()); } if (canSlow) { player.GetComponent <PlayerMovement>().slowPlayerMovementSpeed(spellData.slowMovementSpeed(), spellData.slowDuration()); } if (canLifeSteal) { spellData.owner.GetComponent <PlayerHealth_NET>().AddLife(spellData.damage() * spellData.lifeStealAmount()); } switch (damageType) { case DamageType.DOT: player.playerHealth().TakeDamageOverTime(amountOfTicks, spellData.damage(), timeBetweenTicks, player, spellData.ownerID()); break; case DamageType.Instant: player.playerHealth().TakeDamage(spellData.damage(), spellData.ownerID(), player, transform, spellData.knockbackForce()); break; case DamageType.None: break; } } } } } if (screenshake) { ScreenEffects.Instance.screenShake(); } }