void OnTriggerEnter(Collider other) { if (other.CompareTag("Ability")) { SpellData enemySpellData = other.GetComponent <SpellData>(); if (spellData.owner.m_photonView.isMine && enemySpellData.ownerID() != spellData.ownerID()) { spellData.PlayImpactSound(); Vector3 collisionPoint = other.transform.position; Vector3 normal = collisionPoint - transform.position; Vector3 reflectDir = Vector3.Reflect(other.GetComponent <SpellMovement>().GetSpellDir(), normal); reflectDir.Normalize(); Vector3 pointOnDir = transform.position + reflectDir * 150f; enemySpellData.owner.SetSpellDirection(enemySpellData.InstantiateID(), collisionPoint, pointOnDir, spellData.ownerID()); } } }
void FixedUpdate() { if (isFired) { timeSinceStart += Time.deltaTime; if (timeSinceStart > spellData.travelDuration()) { spellData.owner.SendAbilityHit(spellData.InstantiateID(), true, true); spellData.AbilityImpactEffect(); Destroy(this.gameObject); } float timePassed = (float)(PhotonNetwork.time - m_creationTime); transform.position = m_startPosition + spellDir * spellData.speed() * timePassed; if (rotateTowardsDirection) { RotateTowardsDir(); } } }
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; } } } }
void SeekPlayers(Transform targetThisObject) { spellData.owner.SetSpellDirection(spellData.InstantiateID(), transform.parent.position, targetThisObject.position, spellData.ownerID()); }