Advertisement
pivotraze

Win Script

Dec 2nd, 2012
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
BOO 1.19 KB | None | 0 0
  1. /* This script is licensed under the BSD license.
  2. Author: Cody Dostal
  3. Author Email: allysman21@gmail.com
  4. Date Written: 4/22/2012
  5. Date Last Edited: 4/24/2012
  6. Engine Version: 3.5.1f2
  7. Script Version: v1.1
  8. */
  9.  
  10. /* NOTE: With good chance, you may have to change any hard-coded values in these scripts.
  11. These values work with my version, and may not with your version. */
  12.  
  13. import UnityEngine
  14.  
  15. class Win (MonoBehaviour):
  16.  
  17.     // Setting up Texture and Info
  18.     public winTexture as Texture
  19.  
  20.     def OnGUI ():
  21.        
  22.         GUI.DrawTexture(Rect(0, 0, Screen.width, Screen.height), winTexture)
  23.        
  24.         // Capture mouse click. If you click on button, takes to menu. Click anywhere else, takes back to game.
  25.         if GUI.Button(Rect(10, 10, 150, 50), "Menu"):
  26.             Application.LoadLevel(0)
  27.         elif Event.current != null and Event.current.isMouse:
  28.             resetAndLoad()
  29.            
  30.         // If any key EXCEPT the left mouse button is clicked, call resetAndLoad()
  31.         if Input.anyKeyDown and not Input.GetMouseButtonDown(0):
  32.             resetAndLoad()
  33.            
  34.     def resetAndLoad():
  35.         // Reset all things related to player.
  36.         player.score = 0
  37.         player.lives = 3
  38.         player.missed = 0
  39.        
  40.         // Load the game again, skip menu.
  41.         Application.LoadLevel(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement