Share Pastebin
Guest
Public paste!

multiply shootforce by fire1 button held?

By: a guest | Mar 19th, 2010 | Syntax: JavaScript | Size: 0.77 KB | Hits: 81 | Expires: Never
Copy text to clipboard
  1. var crosshairTexture : Texture2D;
  2. var weaponSelect : Texture2D;
  3. var position : Rect;
  4. var position_Select : Rect;
  5. function Start ()
  6. {
  7.         position = Rect( ( Screen.width - crosshairTexture.width ) / 2, ( Screen.height - crosshairTexture.height ) / 2, crosshairTexture.width, crosshairTexture.height );
  8.         position_Select = Rect( ( Screen.width - weaponSelect.width ) / 2, ( Screen.height - weaponSelect.height ) / 2, weaponSelect.width, weaponSelect.height );
  9. }
  10.  
  11. function OnGUI() // Switch crosshair Texture based on Fire2 down/up state?
  12. {
  13.                 if (Input.GetButtonDown("Fire2"))
  14.                 {
  15.                         if (position == crosshairTexture)
  16.                                 {
  17.                                         GUI.DrawTexture( position_Select, weaponSelect );      
  18.                                 }
  19.                                 else
  20.                                         {
  21.                                                 GUI.DrawTexture( position, crosshairTexture );
  22.                                         }
  23.                 }
  24. }