public override void Undo(Game g) { ICanHaveCounters ichc = (ICanHaveCounters)Target.Value(g); ichc.RemoveCounter(addedCounter); g.GameObjects.Remove(addedCounter); }
public override void Do(Game g) { ICanHaveCounters ichc = (ICanHaveCounters)Target.Value(g); addedCounter = new Counter(Type); g.RegisterGameObject(addedCounter); ichc.AddCounter(addedCounter); }
public override void Undo(Game g) { if (removedCounter == null) { return; } ICanHaveCounters ichc = (ICanHaveCounters)Source.Value(g); ichc.AddCounter(removedCounter.Value(g)); g.GameObjects.Add(removedCounter.Value(g)); }
public override void Do(Game g) { ICanHaveCounters ichc = (ICanHaveCounters)Source.Value(g); Counter cnt = ichc.GetAllCounters(g).Where(x => { return(x.MyType == Type); }).FirstOrDefault(); //Default is null for reference types if (cnt != null) { removedCounter = new LazyGameObject <Counter>(cnt); ichc.RemoveCounter(cnt); g.GameObjects.Remove(cnt); } }