示例#1
0
        public override void Cancel(Actor self, bool keepQueue = false)
        {
            // HACK: force move activities to ignore the transit-only cells when cancelling
            // The idle handler will take over and move them into a safe cell
            if (ChildActivity != null)
            {
                foreach (var c in ChildActivity.ActivitiesImplementing <Move>())
                {
                    c.Cancel(self, false, true);
                }
            }

            foreach (var t in transportCallers)
            {
                t.MovementCancelled(self);
            }

            base.Cancel(self, keepQueue);
        }
示例#2
0
        public IEnumerable <T> ActivitiesImplementing <T>(bool includeChildren = true) where T : IActivityInterface
        {
            if (includeChildren && ChildActivity != null)
            {
                foreach (var a in ChildActivity.ActivitiesImplementing <T>())
                {
                    yield return(a);
                }
            }

            if (this is T)
            {
                yield return((T)(object)this);
            }

            if (NextActivity != null)
            {
                foreach (var a in NextActivity.ActivitiesImplementing <T>())
                {
                    yield return(a);
                }
            }
        }