Пример #1
0
    // --------------------------------------------------------------

    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Player")
        {
            PController playerController = other.gameObject.GetComponent <PController>();
            if (playerController)
            {
                // Kill the player
                playerController.Die();

                // Increase the score for the opposing player
                if (OnPlayerDeath != null)
                {
                    OnPlayerDeath(playerController.GetPlayerNum(false));
                }
            }
        }

        if (other.gameObject.tag == "Falling")
        {
            Falling fall = other.gameObject.GetComponent <Falling>();
            if (fall)
            {
                fall.Die();
            }
        }
    }
Пример #2
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Player")
        {
            PController playerController = other.gameObject.GetComponent <PController>();
            if (playerController)
            {
                // Increase the score for player
                if (OnCollect != null)
                {
                    OnCollect(playerController.GetPlayerNum(true));
                }
            }
        }

        isActive = false;
        this.gameObject.GetComponent <Renderer>().enabled = false;
        this.gameObject.GetComponent <Collider>().enabled = false;
        RespawnTime = MAX_RESPAWN_TIME;
    }