duck

ClickToInspect 3

Dec 12th, 2012
113
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.     public NarrationControl narration;
  9.    
  10.     static bool open = false;
  11.    
  12.     void OnMouseUpAsButton()
  13.     {
  14.         if (!open)
  15.         {
  16.             // jet is not open. Open it up.
  17.             transform.parent.animation["Explode"].speed = 1;
  18.             transform.parent.animation.Play();
  19.             open = true;
  20.             TrainingCamera.GoTo(view);
  21.            
  22.             narration.Play( name );
  23.            
  24.         } else {
  25.             // jet is already open. Close it.
  26.             transform.parent.animation["Explode"].speed = -1;
  27.             transform.parent.animation["Explode"].time = 2;
  28.             transform.parent.animation.Play();
  29.             open = false;
  30.             TrainingCamera.GoToDefault();
  31.            
  32.            
  33.         }
  34.        
  35.        
  36.     }
  37.    
  38. }
Advertisement
Add Comment
Please, Sign In to add comment