Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityStandardAssets.Characters.FirstPerson;
- public class door : MonoBehaviour
- {
- public GameObject exitLocation;
- internal UnityEngine.Vector3 exit_pos;
- internal UnityEngine.Quaternion exit_rot;
- internal FirstPersonController player;
- internal TalkieBox tb_script;
- internal string[] text;
- void Start()
- {
- exit_pos[0] = gameObject.transform.position.x;
- exit_pos[1] = gameObject.transform.position.y;
- exit_pos[2] = gameObject.transform.position.z + 0.2f;
- exit_rot[0] = gameObject.transform.rotation.x;
- exit_rot[1] = gameObject.transform.rotation.y;
- exit_rot[2] = gameObject.transform.rotation.z;
- player = GameObject.FindObjectOfType(typeof(FirstPersonController)) as FirstPersonController;
- tb_script = GameObject.FindObjectOfType(typeof(TalkieBox)) as TalkieBox;
- }
- void OnMouseOver()
- {
- if (Input.GetMouseButtonDown(0))
- {
- if (exitLocation.GetComponent<door>())
- {
- player.gameObject.transform.parent.position = exitLocation.transform.parent.position;
- player.gameObject.transform.parent.rotation = exitLocation.transform.parent.rotation;
- }
- else
- {
- text = new string[] {
- "This door is locked."
- };
- tb_script.UpdateDialog(text);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement