duck

ClickToInspect 2

Dec 12th, 2012
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class ClickToInspect : MonoBehaviour {
  5.    
  6.    
  7.     public CameraView view;
  8.    
  9.     static bool open = false;
  10.    
  11.     void OnMouseUpAsButton()
  12.     {
  13.         if (!open)
  14.         {
  15.             // jet is not open. Open it up.
  16.             transform.parent.animation["Explode"].speed = 1;
  17.             transform.parent.animation.Play();
  18.             open = true;
  19.             TrainingCamera.GoTo(view);
  20.            
  21.         } else {
  22.             // jet is already open. Close it.
  23.             transform.parent.animation["Explode"].speed = -1;
  24.             transform.parent.animation["Explode"].time = 2;
  25.             transform.parent.animation.Play();
  26.             open = false;
  27.             TrainingCamera.GoToDefault();
  28.            
  29.            
  30.         }
  31.        
  32.        
  33.     }
  34.    
  35. }
Advertisement
Add Comment
Please, Sign In to add comment