Esempio n. 1
0
    //Handles when the player approaches a door
    private void PlayerApproach()
    {
        //check for collision between the player and the door
        if (collisionHandler.AABBCollision(player, gameObject))
        {
            //check to see if there are any enemies left in the game
            if (GameObject.FindGameObjectWithTag("Enemy") == null)
            {
                //if there are no enemies left display bright door prompt
                openText.GetComponent <MeshRenderer>().enabled    = true;
                blockedText.GetComponent <MeshRenderer>().enabled = false;

                // if any enemies are left in any rooms other than the final, display blocked text
                if (GameManager.GM.remainNum != 1 && gameObject.name == "Foyer Door")
                {
                    openText.GetComponent <MeshRenderer>().enabled    = false;
                    blockedText.GetComponent <MeshRenderer>().enabled = true;
                }

                //Handle player entering the door
                EnterDoorCheck();
            }
            else
            {
                //if there are enemies left display blocked door prompt
                openText.GetComponent <MeshRenderer>().enabled    = false;
                blockedText.GetComponent <MeshRenderer>().enabled = true;
            }
        }
        else
        {
            //if no collision hide all info text
            openText.GetComponent <MeshRenderer>().enabled    = false;
            blockedText.GetComponent <MeshRenderer>().enabled = false;
        }
    }