Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine.UI;
- public class Spawn : MonoBehaviour {
- public Transform[] spawnLocations;
- public GameObject[] whatToSpawn;
- public GameObject[] whatToSpawnClone;
- public GameObject player;
- public GameObject zombie;
- void Start ()
- {
- spawnZombie();
- zombie.GetComponent<Chase>().player = player.transform;
- }
- void spawnZombie ()
- {
- GameObject zombieOne = Instantiate(whatToSpawn[0], spawnLocations[0].transform.position, Quaternion.Euler(0, 0, 0)) as GameObject;
- zombieOne.GetComponent<Chase>().Player = GameObject.Find("Player").transform;
- GameObject zombieTwo = Instantiate(whatToSpawn[1], spawnLocations[1].transform.position, Quaternion.Euler(0, 0, 0)) as GameObject;
- zombieTwo.GetComponent<Chase>().Player = GameObject.Find("Player").transform;
- GameObject zombieThree = Instantiate(whatToSpawn[2], spawnLocations[2].transform.position, Quaternion.Euler(0, 0, 0)) as GameObject;
- zombieThree.GetComponent<Chase>().Player = GameObject.Find("Player").transform;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement