Ejemplo n.º 1
0
        /// <summary>Checks against the guards for the command.</summary>
        /// <param name="actionInput">The full input specified for executing the command.</param>
        /// <returns>A string with the error message for the user upon guard failure, else null.</returns>
        public override string Guards(ActionInput actionInput)
        {
            var commonFailure = VerifyCommonGuards(actionInput, ActionGuards);

            if (commonFailure != null)
            {
                return(commonFailure);
            }

            sensesBehavior = actionInput.Controller.Thing.Behaviors.FindFirst <SensesBehavior>();
            return(sensesBehavior == null ? "You do not have any senses to perceive with." : null);
        }
Ejemplo n.º 2
0
        /// <summary>Checks against the guards for the command.</summary>
        /// <param name="actionInput">The full input specified for executing the command.</param>
        /// <returns>A string with the error message for the user upon guard failure, else null.</returns>
        public override string Guards(ActionInput actionInput)
        {
            var commonFailure = VerifyCommonGuards(actionInput, ActionGuards);

            if (commonFailure != null)
            {
                return(commonFailure);
            }

            // Rule: the sender must be capable of sensing/perceiving things.
            sensesBehavior = actionInput.Actor.FindBehavior <SensesBehavior>();

            return(sensesBehavior == null ? "You are incapable of perceiving anything." : null);
        }
Ejemplo n.º 3
0
        /// <summary>Checks against the guards for the command.</summary>
        /// <param name="actionInput">The full input specified for executing the command.</param>
        /// <returns>A string with the error message for the user upon guard failure, else null.</returns>
        public override string Guards(ActionInput actionInput)
        {
            string commonFailure = this.VerifyCommonGuards(actionInput, ActionGuards);

            if (commonFailure != null)
            {
                return(commonFailure);
            }

            // Rule: the sender must be capable of sensing/perceiving things.
            this.sensesBehavior = actionInput.Controller.Thing.Behaviors.FindFirst <SensesBehavior>();
            if (this.sensesBehavior == null)
            {
                return("You are incapable of perceiving anything.");
            }

            return(null);
        }