Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Door : MonoBehaviour {
- public string requiredKey;
- private GameObject playerRef;
- private KeyInventory KeyInventory;
- private Animator doorAnimation;
- private BoxCollider collisionBox;
- public void DoesThePlayerHaveTheRightKeyOrNot()
- {
- foreach(string keyName in KeyInventory.Keys)
- {
- if(keyName == requiredKey)
- {
- doorAnimation.SetBool("Begin", true);
- Debug.Log("Player has key "+ keyName);
- }
- }
- }
- // Use this for initialization
- void Start () {
- playerRef = GameObject.Find("FirstPersonCharacter");
- KeyInventory = playerRef.GetComponent<KeyInventory>();
- doorAnimation = GetComponent<Animator>();
- }
- // Update is called once per frame
- void Update () {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement