Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using System.ServiceModel;
- using UnityStoreLibrary;
- public class Trigger : MonoBehaviour {
- public GameObject myGameObject ;
- public GUITexture myGuiTexture;
- private Vector3 rotation;
- private Quaternion initialRotation;
- private GameObject go;
- void Start(){
- myGuiTexture.enabled = false;
- initialRotation = myGameObject.transform.rotation;
- go = new GameObject("Details guiText");
- go.AddComponent(typeof(GUIText));;
- go.guiText.enabled = false;
- }
- void Update () {
- if (myGuiTexture.enabled == true){
- if (Input.GetKeyUp(KeyCode.Alpha1) || Input.GetKeyUp(KeyCode.Keypad1))
- myGameObject.transform.rotation = initialRotation;
- if (Input.GetKey(UnityEngine.KeyCode.Keypad1) || Input.GetKey(UnityEngine.KeyCode.Alpha1)){
- rotation = new Vector3(0, Input.GetAxis("Mouse X"), 0);
- myGameObject.transform.Rotate(rotation);
- }
- }
- }
- void OnTriggerEnter(){
- myGuiTexture.enabled = true;
- }
- void OnTriggerExit(){
- myGuiTexture.enabled = false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement