duck

Untitled

Feb 11th, 2014
172
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 GuiTextButton : MonoBehaviour {
  5.  
  6.     public Texture2D normal;
  7.     public Texture2D over;
  8.     public Unit unit;
  9.     public GameObject machine;
  10.  
  11.  
  12.     void OnMouseEnter(){
  13.    
  14.         guiTexture.texture = over;
  15.  
  16.         if(Input.GetMouseButtonUp(0)){
  17.  
  18.             unit.SetMachine(machine);
  19.         }
  20.     }
  21.  
  22.  
  23.  
  24.     void OnMouseExit(){
  25.        
  26.         guiTexture.texture = normal;
  27.        
  28.        
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment