Advertisement
RealiteeeyyyyTV

Untitled

Jan 13th, 2018
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine.UI;
  5.  
  6. public class Spawn : MonoBehaviour {
  7.  
  8. public Transform[] spawnLocations;
  9. public GameObject[] whatToSpawn;
  10. public GameObject[] whatToSpawnClone;
  11. public GameObject player;
  12. public GameObject zombie;
  13.  
  14. void Start ()
  15. {
  16. spawnZombie();
  17. zombie.GetComponent<Chase>().player = player.transform;
  18. }
  19.  
  20. void spawnZombie ()
  21. {
  22. GameObject zombieOne = Instantiate(whatToSpawn[0], spawnLocations[0].transform.position, Quaternion.Euler(0, 0, 0)) as GameObject;
  23. zombieOne.GetComponent<Chase>().Player = GameObject.Find("Player").transform;
  24.  
  25. GameObject zombieTwo = Instantiate(whatToSpawn[1], spawnLocations[1].transform.position, Quaternion.Euler(0, 0, 0)) as GameObject;
  26. zombieTwo.GetComponent<Chase>().Player = GameObject.Find("Player").transform;
  27.  
  28. GameObject zombieThree = Instantiate(whatToSpawn[2], spawnLocations[2].transform.position, Quaternion.Euler(0, 0, 0)) as GameObject;
  29. zombieThree.GetComponent<Chase>().Player = GameObject.Find("Player").transform;
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement