spy behavior

This commit is contained in:
Chris Forbes
2010-01-15 18:02:05 +13:00
parent 342d6c26d2
commit 4e7c604764
9 changed files with 67 additions and 13 deletions

View File

@@ -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;

View 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; }
}
}

View File

@@ -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;
}