Exemplo n.º 1
0
        public DynamicExpects(Verb verb, MethodInfo handler, DynamicCall call)
        {
            this.call = call;
            this.call = call;

            verbType = verb.GetType();

            Expects = handler;
        }
Exemplo n.º 2
0
        private bool Expects(Verb verb, Object obj, ICommandState commandState)
        {
            var call    = new DynamicCall(parsed.Expects, obj, preposition, indirectObject);
            var expects = new DynamicExpects(verb, parsed.Expects, call);

            var handled = false;
            var success = false;

            var before = CurrentRoom.Location.Before(verb.GetType());

            if (before != null)
            {
                commandState.State = CommandState.Before;
                handled            = before();
            }

            if (!handled)
            {
                commandState.State = CommandState.During;
                success            = expects.Invoke();

                if (success)
                {
                    var after = CurrentRoom.Location.After(verb.GetType());

                    if (after != null)
                    {
                        commandState.State = CommandState.After;
                        after();
                    }
                }
            }


            return(success);
        }