Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //ZombieSpawnerScript.js
- var Zombie : Transform;
- var maxSpawnNumber = 10;
- var spawnInterval = 60;
- var tempSpawnInterval = spawnInterval;
- var spawnNumber = 0;
- var spawnHealth = 100;
- var spawnSpeed : float = 3.0;
- var randomSpeed : boolean = false;
- var minRandom : float = 3;
- var maxRandom : float = 6;
- var jumpEnabled : boolean = false;
- var wander : boolean = false;
- function FixedUpdate () {
- tempSpawnInterval --;
- if(tempSpawnInterval <= 0){
- if(spawnNumber < maxSpawnNumber){
- spawnZombie(spawnHealth, spawnSpeed, randomSpeed, minRandom, maxRandom, jumpEnabled, wander);
- tempSpawnInterval = spawnInterval;
- spawnNumber ++;
- }
- }
- }
- function spawnZombie(health : int, speed : float, randSpeed : boolean, minRandom : float, maxRandom : float, jump : boolean, wander: boolean){
- var newZombieInstance : Transform;
- newZombieInstance = Instantiate(Zombie, transform.position, transform.rotation);
- var zombScript : ZombieScript = newZombieInstance.GetComponent(ZombieScript);
- zombScript.maxHealth = health;
- zombScript.health = health;
- zombScript.zombieSpeed = speed;
- zombScript.randomSpeed = randSpeed;
- zombScript.minRandomSpeed = minRandom;
- zombScript.maxRandomSpeed = maxRandom;
- zombScript.jumpEnabled = jump;
- zombScript.wander = wander;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement