Simple gameplay loop in place

This commit is contained in:
2018-04-10 17:02:42 +10:00
parent 46836ca069
commit efe1cd63f5
25 changed files with 747 additions and 112 deletions
+22
View File
@@ -0,0 +1,22 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MonsterSpawner : MonoBehaviour {
public GameObject monsterPrefab;
public Vector2 motion;
public float delay;
void Awake() {
StartCoroutine (SpawnMonster ());
}
IEnumerator SpawnMonster() {
while(true) {
yield return new WaitForSeconds (delay);
GameObject monster = Instantiate (monsterPrefab);
monster.transform.position = transform.position;
monster.GetComponent<Rigidbody2D> ().velocity = motion;
}
}
}