system
1
Lets say i was playing with fire.
How to I activate a variable in the way as below?
var health = 100;
var burn = health - 20;
The two variables health & Burn now this is what i want to do.
burn
yield WaitForSeconds (5);
burn
yield WaitForSeconds (5);
Anything else doesn’t matter i just want to know how to DO burn variable like activate it
system
2
var healt = 100;
var burnDamage = 20;
var cooldown = 5.0;
var burning = false;
function Update()
{
if(burning)
{
cooldown -= Time.deltaTime;
if(cooldown <= 0)
{
cooldown = 5.0;
health -= burnDamage;
}
}
}
function OnTriggerEnter(collider : Collision)
{
(if(collider.tag == “Fire”))
{
burning = true;
}
}
unction OnTriggerExit()
{
burning = false;
}
system
3
var health : int;
var burn : boolean;
function Start()
{
health = 100;
burn = false;
}
function Update()
{
Burn_Player();
}
function Burn_Player()
{
if(burn)
{
health+= -20;
yield WaitForSeconds (5);
}
}