- Home /
Why will this particle not play?
The particle is supposed to play when Bleeding = true and stop when it equals false. Anyone see an error? I feel like there may be some kind of loop or something making it collide and messing it up.
var Blood : GameObject;
var SystemHealth : GameObject;
var OrigHealth : float = 300; //Make sure this variable gets subtracted at the same rate as Health.
var Health : float = 300;
var RobotHealth : float = 800;
var BloodCheck : boolean = false;
var LimbCheck : boolean = false;
var Prop : GameObject;
var PropDestination : GameObject;
var Robot1 : GameObject;
var Robot2 : GameObject;
var Robot3 : GameObject;
var Robot4 : GameObject;
function Start ()
{
Blood.GetComponent(ParticleSystem).Stop();
}
function Update ()
{
if(BodyArmature.GetComponent(LimbHealth).Health <= 0 && LimbCheck == false)
{
LimbBroke = true;
LimbCheck = true;
BodyMesh.renderer.enabled = false;
SystemHealth.GetComponent(MainPlayerHealth).MaxHealth -= Health;
Bleeding = true;
Prop.transform.parent = PropDestination.transform;
Prop.renderer.enabled = true;
Prop.rigidbody.isKinematic = false;
Prop.rigidbody.mass = 1;
Prop.GetComponent(BoxCollider).enabled = true;
}
if(BodyArmature.GetComponent(LimbHealth).Health >= 100 && LimbCheck == true)
{
LimbBroke = false;
LimbCheck = false;
BodyMesh.renderer.enabled = true;
SystemHealth.GetComponent(MainPlayerHealth).MaxHealth += Health;
Bleeding = false;
Prop.renderer.enabled = false;
Prop.rigidbody.isKinematic = true;
Prop.rigidbody.mass = 0.0001;
Prop.GetComponent(BoxCollider).enabled = false;
}
if(BloodCheck == true) {
//FixedUpdate();
BloodCheck = false;
}
if(BloodCheck == false) {
//FixedUpdate();
BloodCheck = true;
}
if(RobotCheck == true) {
Robot1.renderer.enabled = true;
Robot2.renderer.enabled = true;
Robot3.renderer.enabled = true;
Robot4.renderer.enabled = true;
BodyMesh.renderer.enabled = false;
Bleeding = false;
Health = RobotHealth;
BodyMesh.renderer.enabled = false;
}
if(RobotCheck == false && LimbBroke == false) {
Robot1.renderer.enabled = false;
Robot2.renderer.enabled = false;
Robot3.renderer.enabled = false;
Robot4.renderer.enabled = false;
BodyMesh.renderer.enabled = true;
Health = OrigHealth;
}
if(RobotCheck == false && LimbBroke == true) {
Robot1.renderer.enabled = false;
Robot2.renderer.enabled = false;
Robot3.renderer.enabled = false;
Robot4.renderer.enabled = false;
BodyMesh.renderer.enabled = false;
Bleeding = true;
Health = OrigHealth;
}
if(Bleeding == false) {
Blood.GetComponent(ParticleSystem).Stop();
}
if(Bleeding == true) {
Blood.GetComponent(ParticleSystem).Play();
}
}
function FixedUpdate() {
if(Bleeding == true) {
SystemHealth.GetComponent(MainPlayerHealth).MaxHealth -= BloodLoss;
yield WaitForSeconds(5);
}
}
Comment
You have commented out fixed update?
if(BloodCheck == false) { //FixedUpdate(); BloodCheck = true; }
Your answer

Follow this Question
Related Questions
This boolean is messing up. Help? 1 Answer
Particle collider not working 0 Answers
Is there OnParticleCollisionExit()? If none how to make. 2 Answers
How do you make a Particle System of weather effect look believable when parented to player camera? 0 Answers
Waiting for a Function to Complete 1 Answer