Esempio n. 1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.GetComponent <AbilityBase>())
        {
            if (other.gameObject.GetComponent <AbilityBase>().Type.Equals(Ability.AbilityTypeEnum.Attack))
            {
                return;
            }
            if (other.gameObject.GetComponent <AbilityBase>().Type.Equals(Ability.AbilityTypeEnum.Utility))
            {
                return;
            }
            if (other.gameObject.GetComponent <AbilityBase>().Type.Equals(Ability.AbilityTypeEnum.Defend))
            {
                if (other.gameObject.GetComponent <AbilityBase>().GetTarget() == GetTarget())
                {
                    gameObject.SetActive(false);
                }
            }
        }
        //if other was player or ai (cant hit other projectiles for instance)
        // if(other.CompareTag("Player") || other.CompareTag("AI"))
        if (other.gameObject.GetComponent <Cell>())
        {
            if (other.gameObject == GetTarget())
            {//call function in <Ability>
                DealDamage(other.gameObject, GetDamage());
                Manager.ActionDamage(
                    gameObject.GetComponent <Ability>().AbilityName,
                    other.gameObject.GetComponent <Cell>().CellName,
                    gameObject.GetComponent <AbilityBase>().GetDamage().ToString(),
                    sSender);


                //AudioManager.instance.Play("TakeHit");
                gameObject.SetActive(false);
            }
        }
    }
Esempio n. 2
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject == GetSender())
     {
         return;
     }
     //if other was player or ai (cant hit other projectiles for instance)
     // if(other.CompareTag("Player") || other.CompareTag("AI"))
     if (other.gameObject == GetComponent <AbilityBase>().GetTarget())
     {//call function in <Ability>
         DealDamage(other.gameObject, GetDamage());
         Manager.ActionDamage(
             gameObject.GetComponent <Ability>().AbilityName,
             other.gameObject.GetComponent <Cell>().CellName,
             gameObject.GetComponent <AbilityBase>().GetDamage().ToString(),
             gameObject.GetComponent <AbilityBase>().GetSender().gameObject.GetComponent <Cell>().CellName);
         //spawn the cigarettestationry
         //AudioManager.instance.Play("TakeHit");
         GameObject go = Instantiate(CigaretteStationary, GetTarget().transform.position, Quaternion.identity);
         go.GetComponent <AbilityBase>().SetTarget(GetTarget());
         go.transform.parent = GetTarget().transform;
         gameObject.SetActive(false);
     }
 }