From 8c76175a384dbdd0402060441bb87994272b9271 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Mon, 8 Feb 2010 20:43:20 +1300 Subject: [PATCH] attack-omni support --- OpenRa.Game/OpenRa.Game.csproj | 1 + OpenRa.Game/Traits/AttackOmni.cs | 35 ++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 OpenRa.Game/Traits/AttackOmni.cs diff --git a/OpenRa.Game/OpenRa.Game.csproj b/OpenRa.Game/OpenRa.Game.csproj index d90d1bacc1..b2a8e53483 100644 --- a/OpenRa.Game/OpenRa.Game.csproj +++ b/OpenRa.Game/OpenRa.Game.csproj @@ -118,6 +118,7 @@ + diff --git a/OpenRa.Game/Traits/AttackOmni.cs b/OpenRa.Game/Traits/AttackOmni.cs new file mode 100644 index 0000000000..526cc1bc2b --- /dev/null +++ b/OpenRa.Game/Traits/AttackOmni.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace OpenRa.Traits +{ + class AttackOmniInfo : AttackBaseInfo + { + public override object Create(Actor self) { return new AttackOmni(self); } + } + + class AttackOmni : AttackBase, INotifyBuildComplete + { + bool buildComplete = false; + public void BuildingComplete(Actor self) { buildComplete = true; } + + public AttackOmni(Actor self) : base(self) { } + + public override void Tick(Actor self) + { + base.Tick(self); + + if (!CanAttack(self)) return; + if (self.traits.Contains() && !buildComplete) return; + + DoAttack(self); + } + + protected override void QueueAttack(Actor self, Order order) + { + target = order.TargetActor; + } + } +}