コード例 #1
0
        public override void Undo(Game g)
        {
            ICanHaveCounters ichc = (ICanHaveCounters)Target.Value(g);

            ichc.RemoveCounter(addedCounter);
            g.GameObjects.Remove(addedCounter);
        }
コード例 #2
0
        public override void Do(Game g)
        {
            ICanHaveCounters ichc = (ICanHaveCounters)Target.Value(g);

            addedCounter = new Counter(Type);

            g.RegisterGameObject(addedCounter);

            ichc.AddCounter(addedCounter);
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        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);
            }
        }