Advertisement
rhose87

class

Jun 12th, 2013
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.05 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.ServiceModel;
  4. using UnityStoreLibrary;
  5.  
  6. public class Trigger : MonoBehaviour { 
  7.     public GameObject myGameObject ;
  8.     public GUITexture myGuiTexture;
  9.     private Vector3 rotation;
  10.     private Quaternion initialRotation;
  11.     private GameObject go;
  12.    
  13.     void Start(){
  14.         myGuiTexture.enabled = false;
  15.         initialRotation = myGameObject.transform.rotation;
  16.         go = new GameObject("Details guiText");
  17.         go.AddComponent(typeof(GUIText));;
  18.         go.guiText.enabled = false;
  19.     }
  20.    
  21.     void Update () {
  22.         if (myGuiTexture.enabled == true){
  23.             if (Input.GetKeyUp(KeyCode.Alpha1) || Input.GetKeyUp(KeyCode.Keypad1))
  24.                 myGameObject.transform.rotation = initialRotation;
  25.             if (Input.GetKey(UnityEngine.KeyCode.Keypad1) || Input.GetKey(UnityEngine.KeyCode.Alpha1)){
  26.                 rotation = new Vector3(0, Input.GetAxis("Mouse X"), 0);
  27.                     myGameObject.transform.Rotate(rotation);
  28.             }
  29.         }
  30.     }
  31.    
  32.     void OnTriggerEnter(){
  33.         myGuiTexture.enabled = true;
  34.     }
  35.    
  36.     void OnTriggerExit(){
  37.         myGuiTexture.enabled = false;
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement