Hey Im quite new to scripting and have been trying to get this to work for the past few hours and basicly i am creating a timer and each time that timer goes up by 1 i would like it to scale my object by 0.5 this is what i have so far
function Start () {
var Timer = 0.0;
Vector3 Scale = 0.5,0.5,0.5;
}
function Update ()
{
Timer += Time.deltaTime;
if (Timer + 1) transform.localScale += Scale;
}
as i said i am quite new and would love any help i could get
#pragma strict
function Start ()
{
}
function Update ()
{
driveBackwards();
}
var timer : float = 2.5;
var scale : Vector3; // In the Inspector add for example x=1, y = 1, z=0.
function driveBackwards()
{
timer -= Time.deltaTime;
if (timer <= 0)
{
transform.localScale += scale;
// This reset to the cuurent value variable.
timer = 2.5;
}
}
And to stop scaling:
#pragma strict
function Start ()
{
}
function Update ()
{
driveBackwards();
}
var timer : float = 2.5;
var scale : Vector3; // In the Inspector add for example x=1, y = 1, z=0.
var turnOff : boolean = true;
var curTime : float = 0; // start
var finalTime : float = 4; // max
function driveBackwards()
{
if (turnOff)
{
timer -= Time.deltaTime;
if (timer <= 0)
{
transform.localScale += scale;
// This reset to the cuurent value variable.
timer = 2.5;
CountAnOff ();
}
}
}
function CountAnOff ()
{
curTime += 1;
if (curTime >= finalTime)
{
turnOff = false; // Stop scaling
timer = 0;
}
}
GOOD Luck:)