spy behavior
This commit is contained in:
@@ -35,7 +35,6 @@ namespace OpenRa.Game.Traits.Activities
|
||||
}
|
||||
|
||||
// the engineer is sacrificed.
|
||||
self.Health = 0;
|
||||
Game.world.AddFrameEndTask(w => w.Remove(self));
|
||||
|
||||
return NextActivity;
|
||||
|
||||
25
OpenRa.Game/Traits/Activities/Infiltrate.cs
Normal file
25
OpenRa.Game/Traits/Activities/Infiltrate.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
namespace OpenRa.Game.Traits.Activities
|
||||
{
|
||||
class Infiltrate : IActivity
|
||||
{
|
||||
Actor target;
|
||||
public Infiltrate(Actor target) { this.target = target; }
|
||||
public IActivity NextActivity { get; set; }
|
||||
|
||||
public IActivity Tick(Actor self)
|
||||
{
|
||||
if (target == null || target.IsDead) return NextActivity;
|
||||
if (target.Owner == self.Owner) return NextActivity;
|
||||
|
||||
foreach (var t in target.traits.WithInterface<IAcceptSpy>())
|
||||
t.OnInfiltrate(target, self);
|
||||
|
||||
Game.world.AddFrameEndTask(w => w.Remove(self));
|
||||
|
||||
return NextActivity;
|
||||
}
|
||||
|
||||
public void Cancel(Actor self) { target = null; NextActivity = null; }
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace OpenRa.Game.Traits.Activities
|
||||
{
|
||||
class Steal : IActivity
|
||||
@@ -20,6 +16,8 @@ namespace OpenRa.Game.Traits.Activities
|
||||
|
||||
foreach (var t in target.traits.WithInterface<IAcceptThief>())
|
||||
t.OnSteal(target, self);
|
||||
|
||||
Game.world.AddFrameEndTask(w => w.Remove(self));
|
||||
|
||||
return NextActivity;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user