Added a camera to the A10. That spawns as they attack, and is destroyed as they leave
This commit is contained in:
@@ -23,6 +23,7 @@ namespace OpenRA.Mods.RA
|
||||
[Desc("Armament name")]
|
||||
public readonly string Guns = "secondary";
|
||||
public readonly int FacingTolerance = 2;
|
||||
public readonly WRange VisionRange = WRange.FromCells(10);
|
||||
|
||||
public override object Create(ActorInitializer init) { return new AttackBomber(init.self, this); }
|
||||
}
|
||||
@@ -30,12 +31,14 @@ namespace OpenRA.Mods.RA
|
||||
class AttackBomber : AttackBase, ISync
|
||||
{
|
||||
AttackBomberInfo info;
|
||||
Actor camera;
|
||||
[Sync] Target target;
|
||||
|
||||
public AttackBomber(Actor self, AttackBomberInfo info)
|
||||
: base(self)
|
||||
{
|
||||
this.info = info;
|
||||
this.camera = null;
|
||||
}
|
||||
|
||||
public override void Tick(Actor self)
|
||||
@@ -46,6 +49,23 @@ namespace OpenRA.Mods.RA
|
||||
var cp = self.CenterPosition;
|
||||
var bombTarget = Target.FromPos(cp - new WVec(0, 0, cp.Z));
|
||||
|
||||
// Provide vision
|
||||
if (this.camera == null &&
|
||||
target.IsInRange(self.CenterPosition, this.info.VisionRange))
|
||||
{
|
||||
this.camera = self.World.CreateActor("camera", new TypeDictionary
|
||||
{
|
||||
new LocationInit(target.CenterPosition.ToCPos()),
|
||||
new OwnerInit(self.Owner),
|
||||
});
|
||||
}
|
||||
else if (this.camera != null &&
|
||||
!target.IsInRange(self.CenterPosition, this.info.VisionRange))
|
||||
{
|
||||
self.World.Remove(this.camera);
|
||||
this.camera = null;
|
||||
}
|
||||
|
||||
// Bombs drop anywhere in range
|
||||
foreach (var a in Armaments.Where(a => a.Info.Name == info.Bombs))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user