Implemented: Stances
Added: Basic stances (Aggressive, Guard (Hold Ground), Hold Fire, None (dummy), Return Fire) Added: WorldCommandWidget (to be able to set said stances) Added: WorldCommandWidget to ra (cnc will follow, later on) Changed: Added support to AttackBase for firing with movement disabled + utility method ScanForTarget (used by stances) Added: AssignUnitStance (attach this to unit-producing actors, together with what stances can be picked as 'default')
This commit is contained in:
29
OpenRA.Mods.RA/UnitStances/AssignUnitStance.cs
Normal file
29
OpenRA.Mods.RA/UnitStances/AssignUnitStance.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.UnitStances
|
||||
{
|
||||
public class AssignUnitStanceInfo : TraitInfo<AssignUnitStance>
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class AssignUnitStance : INotifyProduction
|
||||
{
|
||||
public void UnitProduced(Actor self, Actor other, int2 exit)
|
||||
{
|
||||
var stance = UnitStance.GetActive(self);
|
||||
if (stance == null)
|
||||
return;
|
||||
|
||||
var target = other.TraitsImplementing<UnitStance>().Where(t => t.GetType() == stance.GetType()).FirstOrDefault();
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
target.Activate(other);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user