/// <summary>Initializes a new instance of the PlayingState class.</summary> /// <param name="session">The session entering this state.</param> public PlayingState(Session session) : base(session) { Debug.Assert(session.Thing != null); var behavior = session.Thing.Behaviors.FindFirst <PlayerBehavior>(); playerBehavior = new SimpleWeakReference <PlayerBehavior>(behavior); }
/// <summary>Initializes a new instance of the PlayingState class.</summary> /// <param name="session">The session entering this state.</param> public PlayingState(Session session) : base(session) { // JFED -- Temporary workaround - null exceptions if (session.Thing != null) { var behavior = session.Thing.Behaviors.FindFirst <PlayerBehavior>(); playerBehavior = new SimpleWeakReference <PlayerBehavior>(behavior); } string nl = Environment.NewLine; session.Write(string.Format("{0}Welcome, {1}.{0}{0}", nl, Session.Thing.FullName), false); }
/// <summary>Adds the new target.</summary> /// <remarks>Precondition: this.target is null, newTarget is non-null.</remarks> /// <param name="newTarget">The new target.</param> private void AddTarget(Thing newTarget) { var self = this.Parent; if (self != null) { var message = this.CreateFollowMessage(self, newTarget); var followEvent = new FollowEvent(self, message, self, newTarget); self.Eventing.OnMovementRequest(followEvent, EventScope.ParentsDown); if (!followEvent.IsCancelled) { this.target = new SimpleWeakReference <Thing>(newTarget); newTarget.Eventing.MovementEvent += this.ProcessMovementEvent; self.Eventing.OnMovementEvent(followEvent, EventScope.ParentsDown); } } }
/// <summary>Initializes a new instance of the DestinationInfo class.</summary> /// <param name="command">The command which is used to reach the target destination.</param> /// <param name="targetID">The ID of the target destination.</param> public DestinationInfo(string command, string targetID) { ExitCommand = command; TargetID = targetID; CachedTarget = new SimpleWeakReference <Thing>(null); }