ZombieSpawner help
Hello everyone, my script don't work, The zombie are spawing with a delay of 1 seconds when i'm on 0 zombietue and the ROUND is all time at 13 i don't understand why because the variable zombietue work right
pragma strict
ar ZombieHealth : int = 100; var die : int = 1; var ammo : int = 3; private var zombietue : Zombiespawner; private var shoteject : ShotEject; function Start () { zombietue = GameObject.Find("Spawn").GetComponent(Zombiespawner); shoteject = GameObject.Find("Eject").GetComponent(ShotEject); }
function OnCollisionEnter (col : Collision) { if (col.gameObject.tag =="Bullet") { ZombieHealth -=34; }
}
function Update () { if(ZombieHealth <= 0) { GetComponent.().Play("back_fall"); gameObject.GetComponent(ZombieAI).enabled = false; gameObject.GetComponent(CharacterController).enabled = false; gameObject.GetComponent(CapsuleCollider).enabled = false; gameObject.GetComponent(BoxCollider).enabled = false; Dead();
}
}
function Dead()
{
yield WaitForSeconds (2);
zombietue.Zombietue += 1;
shoteject.reserve += ammo;
Destroy (gameObject);
}
pragma strict
ar object : Transform; var wait : int = 15; var Zombietue : int = 0; var Round : int = 1; function Start () { True(); Modificateur();
}
function True () { while (true){ Spawn(); Modificateur(); yield WaitForSeconds(wait); }
} function Spawn(){ Instantiate (object,Vector3(200,0,302),Quaternion.identity); Instantiate (object,Vector3(85,0,383),Quaternion.identity); Instantiate (object,Vector3(85,0,386),Quaternion.identity); Instantiate (object,Vector3(303,0,118),Quaternion.identity); Instantiate (object,Vector3(373,0,188),Quaternion.identity); Instantiate (object,Vector3(292,0,276),Quaternion.identity); Instantiate (object,Vector3(-21,0,-159),Quaternion.identity); Instantiate (object,Vector3(359,0,185),Quaternion.identity); Instantiate (object,Vector3(305,0,254),Quaternion.identity); Instantiate (object,Vector3(236,0,232),Quaternion.identity); Instantiate (object,Vector3(186,0,232),Quaternion.identity); Instantiate (object,Vector3(173,0,144),Quaternion.identity); Instantiate (object,Vector3(256,0,96),Quaternion.identity); Instantiate (object,Vector3(373,0,117),Quaternion.identity); Instantiate (object,Vector3(338,0,178),Quaternion.identity); Instantiate (object,Vector3(327,0,236),Quaternion.identity); Instantiate (object,Vector3(275,0,278),Quaternion.identity); Instantiate (object,Vector3(125,0,117),Quaternion.identity);
} function Modificateur (){ if (Zombietue < 10); { wait = 15; Round = 1; } if (Zombietue > 10); { wait = 14; Round = 2; } if (Zombietue > 20); { wait = 13; Round = 3; } if (Zombietue > 30); { wait = 12; Round = 4; } if (Zombietue > 40); { wait = 11; Round = 5; } if (Zombietue > 50); { wait = 10; Round = 6; } if (Zombietue > 60); { wait = 9; Round = 7; } if (Zombietue > 70); { wait = 8; Round = 8; } if (Zombietue > 80); { wait = 7; Round = 9; } if (Zombietue > 90); { wait = 6; Round = 10; } if (Zombietue > 100); { wait = 5; Round = 11; } if (Zombietue > 200); { wait = 3; Round = 12;; } if (Zombietue > 1000); { wait = 1; Round = 13;; } } function OnGUI() { GUI.Box(Rect(10,80,110,20), "Zombietué : " + Zombietue); GUI.Box(Rect(80,10,110,20), " ROUND : " + Round); }
Please format your code correctly for the site, it's impossible to read this, and therefor impossible to help.
Your answer
Follow this Question
Related Questions
NullReferenceExeption 0 Answers
random spawn points per round 0 Answers
I can't get my spawner to work! pls help fast. 0 Answers
Unity5 Collider error 0 Answers