mirror of
https://github.com/FriendshipIsEpic/FiE-Game.git
synced 2024-11-22 13:58:00 +01:00
43 lines
897 B
C#
43 lines
897 B
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public abstract class FieInput : MonoBehaviour
|
|
{
|
|
protected delegate void updateCallback();
|
|
|
|
private List<FieGameCharacter> _controllableCharacters;
|
|
|
|
protected updateCallback callback;
|
|
|
|
protected List<FieGameCharacter> controllableCharacters => _controllableCharacters;
|
|
|
|
public void Awake()
|
|
{
|
|
FieGameCharacter[] array = Object.FindObjectsOfType(typeof(FieGameCharacter)) as FieGameCharacter[];
|
|
_controllableCharacters = new List<FieGameCharacter>();
|
|
if (array.Length > 0)
|
|
{
|
|
for (int i = 0; i < array.Length; i++)
|
|
{
|
|
if (array[i].intelligenceType == FieGameCharacter.IntelligenceType.Controllable)
|
|
{
|
|
_controllableCharacters.Add(array[i]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public void Update()
|
|
{
|
|
UpdateCallback();
|
|
}
|
|
|
|
private void UpdateCallback()
|
|
{
|
|
if (callback != null)
|
|
{
|
|
callback();
|
|
callback = null;
|
|
}
|
|
}
|
|
}
|