示例#1
0
    void OnTriggerEnter(Collider collider)
    {
        if (collider.gameObject.CompareTag("Trap") && !respawn.respawnRequest)
        {
            deathCount++;

            //Debug.Log("IsGrounded - OnTriggerEnter() TRAP!: " + collider.gameObject.name);
            respawn.RespawnAtCheckpoint(collider);
        }

        if (collider.gameObject.CompareTag("Ground"))
        {
            //Debug.Log("IsGrounded - OnTriggerEnter(): " + collider.gameObject.name);
            isGrounded.increaseGroundCollisions();
        }

        if (collider.gameObject.CompareTag("Key"))
        {
            hud.GetComponent <TextMeshProUGUI>().text = "Keys: " + (++keys).ToString() + " / 3";
            //Debug.Log("IsGrounded - OnTriggerEnter() KEY!: " + collider.gameObject.name);

            GameObject.Find("FireI" + (progress.playthrough).ToString()).GetComponent <ParticleSystem>().Play();

            Destroy(collider.gameObject);
            logger.LogPlayerGK(player.transform.position, GameObject.Find("Game").GetComponent <AssignController>().controllerNum);

            sfx.playKeySound();

            if (progress.playthrough < 3)
            {
                respawn.RespawnAtBeginning();
            }

            if (respawn.newPlaythrough && progress.playthrough < 3)
            {
                progress.PlayerGotKey();
            }
        }
    }