Skip to content

Instantly share code, notes, and snippets.

@DEADB33F
Created September 28, 2012 07:56
Show Gist options
  • Save DEADB33F/3798530 to your computer and use it in GitHub Desktop.
Save DEADB33F/3798530 to your computer and use it in GitHub Desktop.
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