Exemple #1
0
    private void OnTriggerExit2D(Collider2D collision)
    {
        coList.Remove(collision.gameObject);
        if (coList.Count == 0)
        {
            PowerBox pb = collision.GetComponent <PowerBox>();
            pb.setUse(false);

            ON.SetActive(false);
            OFF.SetActive(true);
        }
    }
Exemple #2
0
    // Collision detection
    void OnTriggerEnter2D(Collider2D collision)
    {
        // If it collides with the player
        if (collision.CompareTag("PowerBlock") /*|| collision.CompareTag("Player") || collision.CompareTag("Enemy")*/)
        {
            PowerBox pb = collision.GetComponent <PowerBox>();
            pb.setUse(true);

            coList.Add(collision.gameObject);
            ON.SetActive(true);
            OFF.SetActive(false);
        }
    }