attack-omni support
This commit is contained in:
@@ -118,6 +118,7 @@
|
||||
<Compile Include="Support\OpenAlInterop.cs" />
|
||||
<Compile Include="Support\PerfHistory.cs" />
|
||||
<Compile Include="Sync.cs" />
|
||||
<Compile Include="Traits\AttackOmni.cs" />
|
||||
<Compile Include="Traits\ChoosePaletteOnSelect.cs" />
|
||||
<Compile Include="Traits\CrateSpawner.cs" />
|
||||
<Compile Include="Traits\OreGrowth.cs" />
|
||||
|
||||
35
OpenRa.Game/Traits/AttackOmni.cs
Normal file
35
OpenRa.Game/Traits/AttackOmni.cs
Normal file
@@ -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<Building>() && !buildComplete) return;
|
||||
|
||||
DoAttack(self);
|
||||
}
|
||||
|
||||
protected override void QueueAttack(Actor self, Order order)
|
||||
{
|
||||
target = order.TargetActor;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user