Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the Radiance.Direction structure.
 /// </summary>
 /// <param name="name">The name of the direction.</param>
 /// <param name="value">The Position value of the direction.</param>
 /// <param name="knownDirection">The KnownDirection enumration value for the new direction.</param>
 /// <param name="counterDirectionName">The name of the direction exaclty opposite of this direction.</param>
 /// <param name="altNames">Alternate names for the direction.</param>
 public Direction(string name, Point3 value, KnownDirection knownDirection, string counterDirectionName, params string[] altNames)
 {
     _name           = name;
     _counterName    = counterDirectionName;
     _altNames       = altNames;
     _value          = value;
     _knownDirection = knownDirection;
 }
Exemplo n.º 2
0
 public Direction(KnownDirection value, params string[] aliases)
 {
     Value = value;
     Aliases = new List<string>(aliases);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Gets a value indicating whether or not an exit exists at the specified direction.
 /// </summary>
 /// <param name="direction">The KnownDirection value at which to get the exit exists value.</param>
 /// <returns>True if an exit exists in the specified direction; otherwise false.</returns>
 public bool GetValue(KnownDirection direction)
 {
     return(_place.Properties.GetValue <bool>(String.Concat(Prefix, direction)));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Sets the exit value at the specified direction.
 /// </summary>
 /// <param name="direction">The KnownDirection value at which to set the exit.</param>
 /// <param name="value">A value indicating whether or not an exit exists.</param>
 public void SetValue(KnownDirection direction, bool value)
 {
     _place.Properties.SetValue(String.Concat(Prefix, direction), value);
 }
Exemplo n.º 5
0
 public bool HasExit(KnownDirection direction)
 {
     return Exits.HasExit(direction);
 }
Exemplo n.º 6
0
 public void Exit(Mobile who, KnownDirection direction)
 {
     _mobiles.Remove(who.Id);
 }
Exemplo n.º 7
0
 public void Enter(Mobile who, KnownDirection direction)
 {
     who.Place = this;
     _mobiles.Add(who.Id, who);
     who.EnqueueMessages(NotificationMessage.Name(Name));
 }
Exemplo n.º 8
0
        public static Direction FromPosition(Point3 current, Point3 destination)
        {
            KnownDirection dir = KnownDirection.North;

            if (current.Y > destination.Y)
            {
                // North
                dir = KnownDirection.North;
            }
            else if (current.Y < destination.Y)
            {
                // South
                dir = KnownDirection.South;
            }

            if (current.X > destination.X)
            {
                // West
                if (dir == KnownDirection.North)
                {
                    dir = KnownDirection.Northwest;
                }
                else if (dir == KnownDirection.South)
                {
                    dir = KnownDirection.Southwest;
                }
                else
                {
                    dir = KnownDirection.West;
                }
            }
            else if (current.X < destination.X)
            {
                // East
                if (dir == KnownDirection.North)
                {
                    dir = KnownDirection.Northeast;
                }
                else if (dir == KnownDirection.South)
                {
                    dir = KnownDirection.Southeast;
                }
                else
                {
                    dir = KnownDirection.East;
                }
            }

            if (current.Z > destination.Z)
            {
                // Down
                dir = KnownDirection.Down;
            }
            else if (current.Z < destination.Z)
            {
                // Up
                dir = KnownDirection.Up;
            }

            return(Direction.FromKnownDirection(dir));
        }
Exemplo n.º 9
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="knownDirection"></param>
 /// <returns></returns>
 public static Direction FromKnownDirection(KnownDirection knownDirection)
 {
     return(Direction.FromName(knownDirection.ToString()));
 }