multiply shootforce by fire1 button held?
By: a guest | Mar 19th, 2010 | Syntax:
JavaScript | Size: 0.90 KB | Hits: 100 | Expires: Never
// Toggles the time scale between 1 and 0.7
// whenever the user hits the Fire1 button.
function Update ()
{
if (Input.GetButtonDown ("Fire2")) // get buttonstate, fire bullet on down.
{
if (Time.timeScale == 1.0)
{
Time.timeScale = 0.08; // bulletTime on.
}
else
{
Time.timeScale = 1.0; // bulletTime off.
}
// Adjust fixed delta time according to timescale
// The fixed delta time will now be 0.02 frames per real-time second
Time.fixedDeltaTime = 0.02 * Time.timeScale;
}
if(Input.GetButtonDown ("Fire2"))
{
if (RenderSettings.ambientLight == Color (0.2, 0.2, 0.2))
{
RenderSettings.ambientLight = new Color (0.01, 0.01, 0.01);
// pitch down
}
else
{
RenderSettings.ambientLight = new Color (0.2, 0.2, 0.2);
// pitch back to normal
}
}
}