Skip to content
Snippets Groups Projects
Verified Commit 1e1592a7 authored by Adrian Paschkowski's avatar Adrian Paschkowski :thinking:
Browse files

EnemySpawnController: Simplify round callback

parent d00ad7a5
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class EnemySpawnController : MonoBehaviour, IRoundCallback
public class EnemySpawnController : MonoBehaviour
{
[SerializeField] List<Opponent> enemyList;
......@@ -13,7 +13,6 @@ public class EnemySpawnController : MonoBehaviour, IRoundCallback
Dictionary<Opponent, Image> enemies = new Dictionary<Opponent, Image>();
float mana;
bool running = false;
Opponent activeSpawn;
GameObject enemyImage;
......@@ -30,12 +29,6 @@ public class EnemySpawnController : MonoBehaviour, IRoundCallback
}
}
private void Start()
{
RoundController.instance.roundCallbacks.Add(this);
OnRoundEnd();
}
// Update is called once per frame
void Update()
{
......@@ -77,7 +70,7 @@ public class EnemySpawnController : MonoBehaviour, IRoundCallback
public void OnEnemyMouseDown(string enemyName)
{
SetEnemyToSpawnObject(enemyName);
if (StatsManager.instance.ModifyMana(-1 * (int)activeSpawn.enemyCost) && !running)
if (StatsManager.instance.ModifyMana(-1 * (int)activeSpawn.enemyCost) && !RoundController.instance.roundRunning)
{
dragObject.GetComponent<Image>().sprite = activeSpawn.EnemySprite;
enemyImage = Instantiate(dragObject, GetPreviewWorldPosition(), Quaternion.identity, transform);
......@@ -116,13 +109,4 @@ public class EnemySpawnController : MonoBehaviour, IRoundCallback
return pos;
}
public void OnRoundStart()
{
running = true;
}
public void OnRoundEnd()
{
running = false;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment