2023-02-16 19:07:21 -04:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
public class LevelController : MonoBehaviour {
|
|
|
|
public GameObject artist;
|
|
|
|
public GameObject enemy;
|
|
|
|
public GameObject[] waypoints;
|
|
|
|
|
|
|
|
|
|
|
|
private Queue<GameObject> enemies = new();
|
|
|
|
// Start is called before the first frame update
|
|
|
|
void Start() {
|
|
|
|
spawnEnemy(enemy, waypoints[0].transform.position);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
void Update() {
|
|
|
|
if (Input.GetMouseButtonDown(0)) {
|
2023-02-16 23:44:32 -04:00
|
|
|
var a = Instantiate(artist, Camera.main.ScreenToWorldPoint(Input.mousePosition) + (Vector3.forward * 10), Quaternion.identity);
|
|
|
|
a.GetComponent<ArtistController>().setEnemyQueue(enemies);
|
2023-02-16 19:07:21 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void spawnEnemy(GameObject enemyIn, Vector3 position) {
|
|
|
|
var e = Instantiate(enemyIn, position, Quaternion.identity);
|
|
|
|
var ec = e.GetComponent<GenerationController>();
|
|
|
|
ec.setWaypoints(waypoints);
|
|
|
|
enemies.Enqueue(e);
|
|
|
|
}
|
|
|
|
}
|