Example #1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Wall")
        {
            PlayerBase.transform.position = new Vector3(PlayerRef.StartPos.x, PlayerRef.StartPos.y, PlayerRef.StartPos.z);
        }

        if (other.tag == "Enemy")
        {
            EnemyRef = other.GetComponent <BaseEnemy>();
            if (!EnemyRef.Attacked)
            {
                EnemiesHit.Add(other.GetComponent <BaseEnemy>());
                EnemyRef.Attacked = true;
                IDamage DamRef = other.GetComponent <IDamage>();
                if (DamRef != null)
                {
                    DamRef.TakeDamage(SkillManager.Instance.DashDamage);
                    DamRef.SetDamageText(SkillManager.Instance.DashDamage, false);
                }
                EnemyRef.DamEffect(DamageEffects.ElectricEffect);
                StartCoroutine(ResetAttacked());
            }
        }
    }
Example #2
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.name == "Pet(Clone)")
     {
         CanDamage = false;
     }
     if (CanDamage)
     {
         if (CanSwing)
         {
             IDamage damageInterface = other.GetComponent <IDamage>();
             if (damageInterface != null)
             {
                 damageInterface.TakeDamage(Damage);
                 damageInterface.SetDamageText(Damage, Crit);
                 //playerref.StopAnim();
                 //playerref.CanMove();
                 //playerref.AnimationEvent();
                 //PC.canMove = true;
                 //SwordRef.anim.SetBool("Swing", false);
                 //PR.CanTurn = true;
                 // SwordRef.canSwing = true;
                 CanSwing = false;
             }
         }
     }
     else
     {
         CanDamage = true; // INCASE THE PLAYER HITS THE PET
     }
 }
Example #3
0
    public void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Enemy")
        {
            IDamage DamRef = other.GetComponent <IDamage>();
            if (DamRef != null)
            {
                if (!HasHit)
                {
                    DamRef.TakeDamage(SkillManager.Instance.MagicDamage);
                    DamRef.SetDamageText(SkillManager.Instance.MagicDamage, false);
                    BoltLives--;
                    HasHit = true;
                }
            }
            Hit = Physics.OverlapSphere(transform.position, radius);

            if (BoltLives <= 0 || other.GetComponent <BaseEnemy>().IsDead)
            {
                Destroy(gameObject);
            }


            if (Enemy != null)
            {
                foreach (GameObject Target in EnemiesHit)
                {
                    if (Target.name == Enemy.name && Target != null)
                    {
                        Destroy(gameObject);
                    }
                }
            }

            if (!EnemiesHit.Contains(other.gameObject))
            {
                EnemiesHit.Add(other.gameObject);
            }
            for (int i = 0; i < Hit.Length; i++)
            {
                if (Hit[i].tag == "Enemy" && !EnemiesHit.Contains(Hit[i].gameObject))
                {
                    Enemy  = Hit[i].gameObject;
                    HasHit = false;
                    break;
                }
            }
        }
        if (other.tag == "Wall")
        {
            Destroy(gameObject);
        }
    }
Example #4
0
    public void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Enemy")
        {
            IDamage DamRef = other.GetComponent <IDamage>();
            if (DamRef != null)
            {
                DamRef.TakeDamage(SkillManager.Instance.MagicDamage);
                DamRef.SetDamageText(SkillManager.Instance.MagicDamage, false);
            }

            Destroy(gameObject);
        }
        if (other.tag == "Wall")
        {
            Destroy(gameObject);
        }
    }
Example #5
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Enemy")
        {
            EnemyRef = other.GetComponent <BaseEnemy>();

            EnemyRef = other.GetComponent <BaseEnemy>();
            if (!EnemyRef.Attacked)
            {
                EnemiesHit.Add(other.GetComponent <BaseEnemy>());
                EnemyRef.Attacked = true;
                IDamage DamRef = other.GetComponent <IDamage>();
                if (DamRef != null)
                {
                    DamRef.TakeDamage(SkillManager.Instance.AOEDamage);
                    DamRef.SetDamageText(SkillManager.Instance.AOEDamage, false);
                }
                EnemyRef.DamEffect(DamageEffects.FireEffect);
                StartCoroutine(ResetAttacked());
            }
        }
    }
Example #6
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag != "Enemy" || IsEnemy)
     {
         if (CanDamage)
         {
             if (CanSwing)
             {
                 IDamage damageInterface = other.GetComponent <IDamage>();
                 if (damageInterface != null)
                 {
                     damageInterface.TakeDamage(Damage);
                     damageInterface.SetDamageText(Damage, Crit);
                     CanSwing = false;
                 }
             }
         }
         else
         {
             CanDamage = true; // INCASE THE PLAYER HITS THE PET
         }
     }
 }