private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "LIMIT")
        {
            gameObject.SetActive(false);
        }

        if (other.tag == "Player" && !dead)
        {
            dead = true;
            // deal damage or take damage, depending on if player is attacking or not
            Player_input p = other.transform.GetComponent <Player_input>();
            if (p.attacking)
            {
                audio.clip = sfx[0];
                audio.Play();
                p.add_points((int)transform.position.y + 1);
                StartCoroutine(die());
            }

            else
            {
                audio.clip = sfx[1];
                audio.Play();
                p.take_damage();
                StartCoroutine(die());
            }
        }
    }
    private void OnTriggerStay(Collider other)
    {
        if (other.tag == "Player" && !dead)
        {
            dead = true;
            // deal damage or take damage, depending on if player is attacking or not
            Player_input p = other.transform.GetComponent <Player_input>();
            if (p.attacking)
            {
                this.ani.Play("ki_peace");
                p.add_points((int)transform.position.y + 1);
                StartCoroutine(die());
            }

            else
            {
                ani.Play("ki_discord");
                p.take_damage();
                StartCoroutine(die());
            }
        }
    }
Exemplo n.º 3
0
 public void Awake()
 {
     invenotryOnOff = GameObject.Find("Player").GetComponent <Player_input>();
     selectedItems  = GameObject.Find("Invenotry_Background").GetComponent <Invenotry>().selectedItemsSave;
 }