Example #1
0
 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());
         }
     }
 }