Created
September 28, 2012 07:56
-
-
Save DEADB33F/3798530 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using UnityEngine; | |
public class BulletTime : Part | |
{ | |
private float timescale = 1; | |
protected override void onPartUpdate() | |
{ | |
base.onPartUpdate(); | |
if (Input.GetKeyDown(KeyCode.F6)) | |
{ | |
timescale = Mathf.Clamp(timescale / 2, 0.0625f, 32f); | |
Time.timeScale = timescale; | |
} | |
if (Input.GetKeyDown(KeyCode.F8)) | |
{ | |
timescale = Mathf.Clamp(timescale * 2, 0.0625f, 32f); | |
Time.timeScale = timescale; | |
} | |
if (Input.GetKeyDown(KeyCode.F7)) | |
{ | |
timescale = 1; | |
Time.timeScale = timescale; | |
} | |
// Override other scripts & warp settings from changing timescale while active. | |
if( timescale != 1 && Time.timeScale != timescale) | |
{ | |
Time.timeScale = timescale; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment