ResolveName() public méthode

public ResolveName ( string name ) : IEntity
name string
Résultat IEntity
        private void PerformLook(string[] words)
        {
            if ((words != null) && (words.Length > 1))
            {
                // Look at

                string  name = String.Join(" ", words, 1, words.Length - 1);
                IEntity at   = Location.ResolveName(name);
                if (at == this)
                {
                    SendMessage("You look fabulous!");
                }
                else if (at != null)
                {
                    SendMessage("You see {0} {1}.", at.Name, at.State ?? "standing nearby");
                    if (at is CombatEntity)
                    {
                        var ce = (CombatEntity)at;
                        SendMessage(
                            "{0} has {1} health points remaining{2}",
                            at.Name, ce.CurrentHealth, ce.InCombat ? " and is currently engaged in battle." : "."
                            );
                    }
                }
                else
                {
                    SendMessage("You don't see '{0}' around here.", name);
                }
            }
            else
            {
                // Look around

                if (Location.Description != null)
                {
                    SendMessage(Location.Description);
                }

                if (Location.Exits.Count != 0)
                {
                    SendMessage("Exits from this location:");
                    for (int i = 0; i < Location.Exits.Count; i++)
                    {
                        SendMessage("{0}: {1}", Location.Exits[i].Name, Location.Exits[i].Description);
                    }
                }

                foreach (var e in this.Location.Entities)
                {
                    if (e.Value != this)
                    {
                        SendMessage("{0} is {1}.", e.Value.Description, e.Value.State ?? "standing nearby");
                    }
                }
            }
        }
Exemple #2
0
        IEnumerator <object> NagTask(string player)
        {
            yield return(new Sleep(45));

            IEntity ent = Location.ResolveName(player);

            if (ent != null)
            {
                string messageText = "Kids 'ese days... 'ever stoppin by to visit an ol man... 'eesh.";
                Event.Send(new { Type = EventType.Tell, Sender = this, Recipient = ent, Text = messageText });
            }
            _PlayersToNag.Remove(player);
        }