public virtual void ParseAllObjects()
        {
            Triggers   = new List <Trigger>();
            Processors = new List <Processor>();
            Actions    = new List <Action>();

            List <Tuple <Point, GameObject> > transformedObjects = new List <Tuple <Point, GameObject> >();

            foreach (var item in base.Keys)
            {
                var newObject = GameObjectParser.Parse(this[item]);

                transformedObjects.Add(new Tuple <Point, GameObject>(item, TransformObject(newObject)));
            }

            foreach (var item in transformedObjects)
            {
                this[item.Item1] = item.Item2;

                if (item.Item2 is Trigger)
                {
                    Triggers.Add((Trigger)item.Item2);
                }

                else if (item.Item2 is Processor)
                {
                    Processors.Add((Processor)item.Item2);
                }

                else if (item.Item2 is Action)
                {
                    Actions.Add((Action)item.Item2);
                }
            }
        }
Example #2
0
        public void AssociateObjects()
        {
            foreach (var item in base.Keys)
            {
                var newObject = GameObjectParser.Parse(this[item]);

                transformedObjects.Add(new Tuple <Point, GameObject>(item, TransformObject(newObject)));
            }

            foreach (var item in transformedObjects)
            {
                this[item.Item1] = item.Item2;

                if (item.Item2 is Trigger)
                {
                    Triggers.Add((Trigger)item.Item2);
                }

                else if (item.Item2 is Processor)
                {
                    Processors.Add((Processor)item.Item2);
                }

                else if (item.Item2 is Action)
                {
                    Actions.Add((Action)item.Item2);
                }
            }
        }
Example #3
0
        public void Triggered(GameObject source, GameConsole console)
        {
            GameObjectCollection parent = null;

            Parent.TryGetTarget(out parent);

            ResolvedTargets = GameObjectParser.ResolveTargets(this, TargetIds, parent, console, DeepProcess);

            for (int i = 0; i < ResolvedTargets.Length; i++)
            {
                if (ResolvedTargets[i] is ITarget)
                {
                    ((ITarget)ResolvedTargets[i]).Triggered(this, console);
                }
            }
        }
Example #4
0
        public override void Process(GameConsole console)
        {
            // Check for condition pass
            if (Condition(this, console))
            {
                GameObjectCollection parent = null;
                Parent.TryGetTarget(out parent);

                ResolvedTargets = GameObjectParser.ResolveTargets(this, TargetIds, parent, console, DeepProcess);

                //Result(this, parent, console);

                for (int i = 0; i < ResolvedTargets.Length; i++)
                {
                    if (ResolvedTargets[i] is ITarget)
                    {
                        ((ITarget)ResolvedTargets[i]).Triggered(this, console);
                    }
                }
            }
        }