Пример #1
0
        private void ResetGame()
        {
            lives = 4;
            score = 0;
            DIContainer.Add <Dictionary <int, GameObject> >("GameObjects", GameObjects);
            DIContainer.Add <Queue <Tuple <int, GameObject> > >("AddQueue", addQueue);
            DIContainer.Add <Queue <Tuple <int, GameObject> > >("RemoveQueue", removeQueue);

            collider = new Collider();
            DIContainer.Add <Collider>("Collider", collider);
            alienBag = new AlienBag();
            DIContainer.Add <AlienBag>("AlienBag", alienBag);
            alienBag.AllDead      += (o, e) => NextLevel(currentLevel++);
            alienBag.AlienDead    += (o, e) => updateScore(e);
            alienBag.AlienVictory += (o, e) =>
            {
                isAlienVictorious = true;
                commander.Kill();
            };
            font = DIContainer.Get <AssetLoader>("AssetLoader").Content.Load <SpriteFont>("courier");
        }
Пример #2
0
        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();
        }
Пример #3
0
 public AlienBag()
 {
     gameObjects = DIContainer.Get <Dictionary <int, GameObject> >("GameObjects");
     addQueue    = DIContainer.Get <Queue <Tuple <int, GameObject> > >("AddQueue");
 }
Пример #4
0
 public void BeforeStart(GameStageSettings settings = null)
 {
     font = DIContainer.Get <AssetLoader>("AssetLoader").Content.Load <SpriteFont>("courier");
 }