public void ChangeStage(GAMESTAGE eStage) { IGameStage stage = null; if (gameStageDic.ContainsKey(eStage)) { stage = gameStageDic[eStage]; } else { stage = GetStage(eStage); gameStageDic.Add(eStage, stage); } if (gameStage == null) { gameStage = stage; gameStage.OnEnter(); return; } if (gameStage == stage) { return; } gameStage.OnExit(); gameStage = stage; gameStage.OnEnter(); }
private void startNewGame() { //TODO: Refactor this DIContainer part and see where it should sit rather than call it twice //DIContainer.Clear(); //DIContainer.Add<AssetLoader>("AssetLoader", loader); currentStage = createGameStages(); currentStage.BeforeStart(); currentStage.Start(); }
public override void Update(double elapsedTime) { if (this.stage.IsFinish) { IGameStage newStage = new LFVGame.Stages.StageOne(); newStage.LoadComponents(); this.stage.Dispose(); this.stage = newStage; } this.stage.Update(elapsedTime); }
//private bool orent; public GameService(SnakeSounds sound) { POINT = 15; stage = new GameStageService(STAGE_WIDTH, STAGE_HEIGTH); bug = new BugService(STAGE_WIDTH, STAGE_HEIGTH); snake = new SnakeService(); food = new FoodService(); player = new PlayerService(); barrier = new BarrierService(); snakeSound = new SnakeSoundsService(sound.SnakeSound); backgroundSound = new GameBackgroundSoundsService(sound.BackgroundSound); }
public ParticleSystem(IGameStage stage, int posx, int posy, Particle particleToEmit, int delay, int count, int rate, float angle, float angleRange) : base(null) { this.particlesFired = 0; this.location.X = posx; this.location.Y = posy; this.tickDelay = delay; this.particle = particleToEmit; this.particleCount = count; this.particleRate = rate; this.fireAngle = angle; this.fireAngleRangle = angleRange; }
private IGameStage GetStage(GAMESTAGE e) { IGameStage stage = null; switch (e) { case GAMESTAGE.GAMESTAGE_LOGIN: stage = new GameLogin(); break; case GAMESTAGE.GAMESTAGE_MAIN: break; default: break; } return(stage); }
/// <summary> /// Create all the stages of the game and wire them up to load one after the other /// </summary> private IGameStage createGameStages() { var stage1 = new MainScreen("MainScreen"); var stage2 = new Level("Level"); var stage2Settings = new GameStageSettings(); stage2Settings.Set("replay", true); var stage3 = new GameOver("GameOver"); stage1.Next = stage2; stage2.Next = stage3; stage3.Next = stage1; stage1.End += (o, e) => { currentStage = stage2; currentStage.BeforeStart(); currentStage.Start(); bool?shouldRecord = stage2Settings["replay"] as bool?; if (shouldRecord.HasValue && shouldRecord == true) { loopId = 0; replay = new Replay(); replay.StartRecordingReplay(); } }; stage2.End += (o, e) => { bool?shouldRecord = stage2Settings["replay"] as bool?; if (shouldRecord.HasValue && shouldRecord == true) { replay.CompleteReplay(); } currentStage = stage3; currentStage.BeforeStart(); currentStage.Start(); }; stage3.End += (o, e) => { startNewGame(); }; return(stage1); }
protected override void BeginRun() { DIContainer.Clear(); DIContainer.Add <AssetLoader>("AssetLoader", loader); if (doReplay == false) { startNewGame(); } else { this.IsFixedTimeStep = true; //this.graphics.SynchronizeWithVerticalRetrace = false; //this.graphics.ApplyChanges(); this.TargetElapsedTime = TimeSpan.FromMilliseconds(8.333333); replayEvents = Replay.Load(replayFilePath); currentStage = new Level("Level"); currentStage.End += (o, e) => Exit(); currentStage.BeforeStart(); currentStage.Start(); } base.BeginRun(); }
private void OnDestroy() { gameStage = null; gameStageDic.Clear(); }
private void _init(IGameStage gameStage, IGameScore gameScore) { _gameStage = gameStage; _gameScore = gameScore; }
private void _init(IController controller, IGameStage gameStage) { _controller = controller; _gameStage = gameStage; }