FiE-Game/Assets/Scripts/Fie/AI/FieAITaskBase.cs

48 lines
915 B
C#
Raw Normal View History

2018-11-20 20:10:49 +01:00
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Fie.AI
{
public abstract class FieAITaskBase : FieAITaskInterface
{
protected delegate bool TaskDelegate(FieAITaskController manager);
protected float currentTime;
public Dictionary<Type, int> nextStateWeightList = new Dictionary<Type, int>();
protected event TaskDelegate taskEvent;
public FieAITaskBase()
{
taskEvent += Task;
}
public virtual bool TaskExec(FieAITaskController manager)
{
if (this.taskEvent == null)
{
return true;
}
currentTime += Time.deltaTime;
return this.taskEvent(manager);
}
public virtual void Initialize(FieAITaskController manager)
{
}
public virtual void Terminate(FieAITaskController manager)
{
}
public abstract bool Task(FieAITaskController manager);
public Dictionary<Type, int> GetWeight()
{
return nextStateWeightList;
}
}
}