Exemple #1
0
 void Awake()
 {
     time       = 0f;
     contador   = 0;
     enemyBehav = GetComponent <EnemyBehav>();
     ripple     = Camera.main.GetComponent <RipplePostProcess>();
 }
Exemple #2
0
 // Use this for initialization
 public void Awake()
 {
     currentVida = MAX_VIDA;
     anim        = this.GetComponent <Animator>();
     enemyBehav  = this.GetComponent <EnemyBehav>();
     enemySounds = this.GetComponent <AudioSource>();
     isDead      = false;
 }
Exemple #3
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        EnemyBehav enemyBehav = collision.GetComponent <EnemyBehav>();

        if (collision.tag == "Enemy" && !PlayerBehav.Instance.enemyList.Contains(enemyBehav))

        {
            PlayerBehav.Instance.enemyList.Add(collision.GetComponent <EnemyBehav>());
        }
    }
Exemple #4
0
 private void OnTriggerExit2D(Collider2D collision)
 {
     if (collision.tag == "Enemy")
     {
         EnemyBehav enemyBehav = collision.GetComponent <EnemyBehav>();
         if (PlayerBehav.Instance.enemyList.Contains(enemyBehav))
         {
             PlayerBehav.Instance.enemyList.Remove(enemyBehav);
         }
     }
 }
Exemple #5
0
    void MeleeAttack(float damage, float range)
    {
        Collider[] colliders = Physics.OverlapBox(transform.position + transform.forward * (range / 2), new Vector3(1, 1, range / 2), GlobalRef.cameraPos.rotation);

        for (int i = 0; i < colliders.Length; i++)
        {
            if (colliders[i].tag == "Enemy")
            {
                Debug.Log("Hit Enemy");
                EnemyBehav enemy = colliders[i].gameObject.GetComponent <EnemyBehav>();
                enemy.Hit(damage);
            }
        }
    }