Share Pastebin
Guest
Public paste!

multiply shootforce by fire1 button held?

By: a guest | Mar 19th, 2010 | Syntax: JavaScript | Size: 0.90 KB | Hits: 100 | Expires: Never
Copy text to clipboard
  1. // Toggles the time scale between 1 and 0.7
  2. // whenever the user hits the Fire1 button.
  3. function Update ()
  4. {
  5.     if (Input.GetButtonDown ("Fire2")) // get buttonstate, fire bullet on down.
  6.                 {
  7.                 if (Time.timeScale == 1.0)
  8.                                 {
  9.                         Time.timeScale = 0.08; // bulletTime on.
  10.                         }
  11.                 else
  12.                                 {
  13.                         Time.timeScale = 1.0; // bulletTime off.
  14.                                 }
  15.         // Adjust fixed delta time according to timescale
  16.         // The fixed delta time will now be 0.02 frames per real-time second
  17.         Time.fixedDeltaTime = 0.02 * Time.timeScale;
  18.     }
  19.        
  20.         if(Input.GetButtonDown ("Fire2"))
  21.        
  22.                 {
  23.                 if      (RenderSettings.ambientLight == Color (0.2, 0.2, 0.2))
  24.                         {
  25.                                 RenderSettings.ambientLight = new Color (0.01, 0.01, 0.01);
  26.                                 // pitch down
  27.                         }
  28.                 else
  29.                         {
  30.                                 RenderSettings.ambientLight = new Color (0.2, 0.2, 0.2);
  31.                                 // pitch back to normal
  32.                         }
  33.                 }
  34.  
  35. }