Edited UnitCreator to push new units to unit list

This commit is contained in:
vylion 2016-10-29 02:10:04 +02:00
parent c4a5659c35
commit 6870630d8b

View file

@ -7,7 +7,7 @@ public class UnitCreator : MonoBehaviour {
public GameObject lichObject; public GameObject lichObject;
public UnitBehaviour playerLich; public UnitBehaviour playerLich;
public GameObject skeletonObject; public GameObject skeletonObject;
public GameObject[] units; public List<GameObject> units;
private UnitBehaviour script; private UnitBehaviour script;
@ -19,7 +19,7 @@ public class UnitCreator : MonoBehaviour {
// Use this for initialization // Use this for initialization
void Start () { void Start () {
units = new GameObject[0]; units = new List<GameObject> ();
} }
// Update is called once per frame // Update is called once per frame
@ -40,6 +40,7 @@ public class UnitCreator : MonoBehaviour {
} else if (type == UnitType.Skeleton) { } else if (type == UnitType.Skeleton) {
GameObject skeleton; GameObject skeleton;
skeleton = Instantiate (skeletonObject, posVec3, Quaternion.identity); skeleton = Instantiate (skeletonObject, posVec3, Quaternion.identity);
units.Add (skeleton);
} }
} }
} }