parent
8f8b1b7da1
commit
f4e4d78758
@ -1,20 +1,55 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CMSGame
|
||||
{
|
||||
public class Goal
|
||||
public class Goal<TContext>
|
||||
{
|
||||
public string Name = string.Empty;
|
||||
|
||||
public bool IsValid;
|
||||
|
||||
public int BasePriority;
|
||||
|
||||
public List<GoalValidityModifier<TContext>> ValidityModifiers = new();
|
||||
|
||||
public List<GoalPriorityModifier<TContext>> PriorityModifiers = new();
|
||||
|
||||
public bool IsValid()
|
||||
{
|
||||
return ValidityModifiers.All(modifier => modifier.Execute());
|
||||
}
|
||||
|
||||
public int Priority()
|
||||
{
|
||||
return BasePriority + PriorityModifiers.Sum(modifier => modifier.Execute());
|
||||
}
|
||||
}
|
||||
|
||||
public class BattleGoal : Goal
|
||||
public abstract class GoalModifier<TContext>
|
||||
{
|
||||
public string Name = string.Empty;
|
||||
|
||||
public TContext Context;
|
||||
|
||||
protected GoalModifier(TContext context)
|
||||
{
|
||||
Context = context;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class GoalValidityModifier<TContext> : GoalModifier<TContext>
|
||||
{
|
||||
protected GoalValidityModifier(TContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public abstract bool Execute();
|
||||
}
|
||||
|
||||
public class GoalModifier
|
||||
public abstract class GoalPriorityModifier<TContext> : GoalModifier<TContext>
|
||||
{
|
||||
protected GoalPriorityModifier(TContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public abstract int Execute();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in new issue