2019-04-27 20:19:35 +00:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
public class TurnHandler : MonoBehaviour
|
|
|
|
{
|
|
|
|
public void OnTurn() {
|
|
|
|
AI[] ais = gameObject.GetComponentsInChildren<AI>();
|
|
|
|
foreach(AI ai in ais) {
|
|
|
|
ai.OnTurn();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-28 12:11:21 +00:00
|
|
|
public List<Entity> GetEntityAtPosition(Vector2Int position) {
|
2019-04-27 20:19:35 +00:00
|
|
|
Entity[] entities = GetComponentsInChildren<Entity>();
|
2019-04-28 12:11:21 +00:00
|
|
|
List<Entity> found = new List<Entity>();
|
2019-04-27 20:19:35 +00:00
|
|
|
foreach(Entity entity in entities) {
|
|
|
|
if(entity.MapPosition == position) {
|
2019-04-28 12:11:21 +00:00
|
|
|
found.Add(entity);
|
2019-04-27 20:19:35 +00:00
|
|
|
}
|
|
|
|
}
|
2019-04-28 12:11:21 +00:00
|
|
|
return found;
|
2019-04-27 20:19:35 +00:00
|
|
|
}
|
|
|
|
}
|