Esempio n. 1
0
        /// <summary>
        /// Executes this command
        /// </summary>
        public override void Execute()
        {
            List <string> sb = new List <string>();

            //Just do a blank execution as the channel will handle doing the room updates
            if (Subject == null)
            {
                //sb.AddRange(OriginLocation.CurrentLocation.RenderToVisible(Actor));

                ///Need to do like HMR with a simple "update UI" pipeline TODO
                Message blankMessenger = new Message(new LexicalParagraph("You observe your surroundings."));

                blankMessenger.ExecuteMessaging(Actor, (IEntity)Subject, null, OriginLocation.CurrentRoom, null);
                return;
            }

            ILookable lookTarget = (ILookable)Subject;

            ILexicalParagraph toOrigin = new LexicalParagraph("$A$ looks at $T$.");

            ILexicalParagraph toSubject = new LexicalParagraph("$A$ looks at YOU.");

            Message messagingObject = new Message(lookTarget.RenderToVisible(Actor))
            {
                ToOrigin = new List <ILexicalParagraph> {
                    toOrigin
                },
                ToSubject = new List <ILexicalParagraph> {
                    toSubject
                }
            };

            messagingObject.ExecuteMessaging(Actor, (IEntity)Subject, null, OriginLocation.CurrentRoom, null);
        }
Esempio n. 2
0
        private string Look(string[] command)
        {
            ILookable target    = null;
            string    adjective = "";
            string    noun      = "";

            if (command.Length == 2)
            {
                noun   = command[1];
                target = CurrentLocation.FindTarget(noun);
            }
            else if (command.Length == 3)
            {
                adjective = command[1];
                noun      = command[2];
                target    = CurrentLocation.FindTarget(noun, adjective);
            }

            if (target != null)
            {
                return($"You see {target.Look()}.");
            }
            else
            {
                return("I can't find what you are looking for.");
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Examine an entity
        /// </summary>
        /// <param name="item"></param>
        /// <param name="describeIfEmpty">If true, will return the short description if there is no extended description</param>
        /// <returns></returns>
        public static string Examine(this ILookable item, bool describeIfEmpty = false)
        {
            if (describeIfEmpty && String.IsNullOrWhiteSpace(item.ExtendedDescription))
            {
                return(item.Description);
            }

            return(item.ExtendedDescription);
        }
Esempio n. 4
0
        public LookSystem(ILookable lookable, Point pov)
        {
            this.lookable = lookable;
            this.pov = pov;
            lookDistance = lookable.LookDistance (pov);

            foreach (MoveDirection direction in Extensions.aroundDirections) {

                lookResult.Add (direction, new List<int> ());
                pointsInDirectionCache.Add (direction, null);

            }
        }
Esempio n. 5
0
 /// <summary>
 /// Describe an entity
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 public static string Describe(this ILookable item)
 {
     return(item.Description);
 }