public Car() { stoppedState = new StoppedState(this); drivingState = new DrivingState(this); state = stoppedState; }
protected override void SetupStates() { var stoppedState = new StoppedState(this); var followingState = new FollowingTarget(this, tryingToOpenDoorSound, () => brokeDoorPercentage, timeToWaitWhenWalkingAndSeePlayer); var walkAroundState = new WalkAroundState(this, tryingToOpenDoorSound, () => brokeDoorPercentage, timeToWaitWhenWalkingAndSeePlayer, () => numberOfFlagsToLookAt, () => numberOfFlagsToSkip); var killingTargetState = new KillingTargetState(this, macheteSound); var seenTargetTransition = new TargetOnSightTransition(this, followingState, seeYou); var targetIsCloseToKill = new TargetIsClose(this, killingTargetState, distanceToKillTarget, () => coolDownAfterCloseDoor > minKillCoolDownAfterCloseDoor); var targetUnreachable = new TargetUnreachable(this, walkAroundState); var targetGiveUp = new TargetGiveUp(this, walkAroundState, () => timeToGiveUp); stoppedState.SetTransitions(seenTargetTransition); followingState.SetTransitions( targetIsCloseToKill, targetUnreachable, targetGiveUp); walkAroundState.SetTransitions(seenTargetTransition); SetFirstState(walkAroundState); allStates = new State[] { stoppedState, followingState, walkAroundState, killingTargetState }; }
public Vcr() { StoppedState = new StoppedState(this); PlayingState = new PlayingState(this); RecordingState = new RecordingState(this); State = StoppedState; }
public Vcr() { StoppedState = new StoppedState(this); PlayingState = new PlayingState(this); RecordingState = new RecordingState(this); State = StoppedState; }
public override void Initialize() { initSprites(); State = new StoppedState(this); base.Initialize(); }
public VideoNodeState SetState(MediaElementState mediaState, IVideoNode context) { if (_states.ContainsKey(mediaState + "State")) { return(_states[mediaState + "State"]); } switch (mediaState) { case MediaElementState.Buffering: var bufferingState = new BufferingState(this, context); _states.Add(bufferingState.GetType().Name, bufferingState); return(bufferingState); case MediaElementState.Playing: var playingState = new PlayingState(this, context); _states.Add(playingState.GetType().Name, playingState); return(playingState); case MediaElementState.Stopped: var stoppedState = new StoppedState(this, context); _states.Add(stoppedState.GetType().Name, stoppedState); return(stoppedState); case MediaElementState.Opening: var openingState = new OpeningState(this, context); _states.Add(openingState.GetType().Name, openingState); return(openingState); case MediaElementState.Paused: var pausedState = new PausedState(this, context); _states.Add(pausedState.GetType().Name, pausedState); return(pausedState); default: return(null); } }