Finish theif logic. TODO: Determine amount to steal

This commit is contained in:
Paul Chote
2010-01-08 21:59:28 +13:00
parent d03ee4c0c5
commit fc2b671b2c
6 changed files with 35 additions and 25 deletions

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OpenRa.Game.Traits.Activities
{
class Steal : IActivity
{
Actor target;
public Steal(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<IAcceptThief>())
t.OnSteal(target, self);
return NextActivity;
}
public void Cancel(Actor self) { target = null; NextActivity = null; }
}
}