Advertisement
duck

ClickToInspect 1

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