Create singletons for AttackOrFleeFuzzy rulesets.

This avoids the cost of recreating the engines and rules for every AI and AI squad.
This commit is contained in:
RoosterDragon
2016-02-10 20:17:27 +00:00
parent 6093398de3
commit 3b480ea4bb
6 changed files with 133 additions and 148 deletions

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.AI
{
protected virtual bool ShouldFlee(Squad owner)
{
return base.ShouldFlee(owner, enemies => !owner.AttackOrFleeFuzzy.CanAttack(owner.Units, enemies));
return base.ShouldFlee(owner, enemies => !AttackOrFleeFuzzy.Default.CanAttack(owner.Units, enemies));
}
}
@@ -42,7 +42,7 @@ namespace OpenRA.Mods.Common.AI
if (enemyUnits.Any())
{
if (owner.AttackOrFleeFuzzy.CanAttack(owner.Units, enemyUnits))
if (AttackOrFleeFuzzy.Default.CanAttack(owner.Units, enemyUnits))
{
foreach (var u in owner.Units)
owner.Bot.QueueOrder(new Order("AttackMove", u, false) { TargetLocation = owner.TargetActor.Location });