redesign: Agents
This commit is contained in:
@@ -1,60 +0,0 @@
|
||||
using Polonium.Interfaces;
|
||||
|
||||
namespace Polonium.Agents;
|
||||
|
||||
public abstract class AgentAction
|
||||
{
|
||||
}
|
||||
|
||||
public abstract class AgentAction<TAgent, TAgentDecisionMaker, TAgentKnowledge, TAgentAction> : AgentAction, ITimeConsumer
|
||||
where TAgent : Agent<TAgent, TAgentDecisionMaker, TAgentKnowledge, TAgentAction>, new()
|
||||
where TAgentDecisionMaker : AgentDecisionMaker<TAgent, TAgentDecisionMaker, TAgentKnowledge, TAgentAction>, new()
|
||||
where TAgentKnowledge : AgentKnowledge<TAgent, TAgentDecisionMaker, TAgentKnowledge, TAgentAction>, new()
|
||||
where TAgentAction : AgentAction<TAgent, TAgentDecisionMaker, TAgentKnowledge, TAgentAction>, new()
|
||||
{
|
||||
|
||||
public int Level { get; private set; }
|
||||
|
||||
public abstract int MaxLevel { get; }
|
||||
|
||||
public virtual void LevelUp()
|
||||
{
|
||||
if(Level < MaxLevel)
|
||||
Level++;
|
||||
}
|
||||
|
||||
public AgentAction(double coolDown)
|
||||
{
|
||||
CoolDown = coolDown;
|
||||
PoloniumRegistry.Instance.TimeConsumers.Add(this);
|
||||
}
|
||||
|
||||
public abstract class ActionParameter
|
||||
{
|
||||
}
|
||||
|
||||
public virtual bool Execute(ActionParameter parameter)
|
||||
{
|
||||
if (Disabled || CoolDown > 0)
|
||||
return false;
|
||||
CoolDownTime = CoolDown;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private double CoolDownTime { get; set; }
|
||||
public bool Disabled { get; set; }
|
||||
|
||||
private double CoolDown { get; }
|
||||
|
||||
public void Process(double delta)
|
||||
{
|
||||
|
||||
if (Disabled || CoolDownTime <= 0)
|
||||
return;
|
||||
CoolDownTime -= delta;
|
||||
if (CoolDownTime <= 0)
|
||||
CoolDownTime = 0;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user