예제 #1
0
    //Is used to determine whether the player can unlock and open the door
    public void lockedDoor()
    {
        //Accesses door animation
        _animator = GetComponentInChildren <Animator>();
        //Accesses bool that dettermines whether the player has the key
        hasKey = Key.GetComponentInParent <s_Key>().hasKey;
        if (hasKey == true)
        {
            //Checks if the player has opened the locked door before
            if (firstOpened == true)
            {
                firstOpened = false;
                //Sets state change message to: Unlocked!
                text_stateChangeMessage.text = item.itemMessage.ToString();
                i_Properties.StartCoroutine("textFade");
            }

            openDoor = !openDoor;
            //animation for door trigger
            _animator.SetBool("open", openDoor);
            UpdateDoorMessage();
        }
        else
        {
            //state change message is set to: Locked!
            text_stateChangeMessage.text = item.stateChangeMessage.ToString();
            i_Properties.StartCoroutine("textFade");
        }
    }
예제 #2
0
 public void pickUpItem() //states haskey as true, makes the mesh disappear and enables the player to unlock certain doors
 {
     if (keyPickedUp == false)
     {
         keyPickedUp = !keyPickedUp;
         hasKey      = true;                                                // player has key
         ItemUse     = !ItemUse;
         Key.SetActive(false);                                              //Gameobject is disabled
         text_itemMessage.text        = item.stateChangeMessage.ToString(); // turns item message text into state change message text
         text_stateChangeMessage.text = item.stateChangeMessage.ToString();
         i_Properties.StartCoroutine("textFade");
     }
 }