Esempio n. 1
0
 public void LookAt(string thing)
 {
     if (String.IsNullOrWhiteSpace(thing))
     {
         Console.WriteLine("Please select a Object to look at.");
     }
     else
     {
         GameObject subject = CurrentRoom.Items.Find(x => x.Name.ToLower() == thing);
         if (subject == null)
         {
             subject = CurrentRoom.NPCs.Find(x => x.Name.ToLower() == thing);
         }
         if (subject == null)
         {
             subject = Inventory.Find(x => x.Name.ToLower() == thing);
         }
         if (subject == null)
         {
             Console.WriteLine("There is nothing with the name '" + thing + "' in the room.");
         }
         else
         {
             Console.WriteLine(subject.Description);
             if (subject is Weapon)
             {
                 Weapon weapon = (Weapon)subject;
                 Console.WriteLine(weapon.Name + " can be used as a weapon and causes " + weapon.Damage + " damage.");
             }
             else if (subject is Potion)
             {
                 Potion potion = (Potion)subject;
                 Console.WriteLine(potion.Name + " can be consumed and is capable of curing " + potion.Cure + " healthpoints.");
             }
         }
     }
 }