コード例 #1
0
 private void GetNextPopulation(int maxPopGenerationNumber)
 {
     Player            = new Player(new Vector2(300, 600), new Vector2(20, 20), "2D\\Player");
     ScoreSprite       = new ScoreSprite(Player, maxPopGenerationNumber);
     Enemies           = EnemyRepository.GetEnemiesFromDb();
     CurrentPopulation = Population.First(x => x.AfterGame == false);
 }
コード例 #2
0
 private void SetDefaultValues()
 {
     Player            = new Player(new Vector2(300, 600), new Vector2(19, 19), "2D\\Player");
     ScoreSprite       = new ScoreSprite(Player, PopulationRepository.MaxPopGenerationNumber);
     Population        = PopulationMapper.MapEntirePopDbToPop(PopulationRepository.GetPopulationFromDb());
     Enemies           = EnemyRepository.GetEnemiesFromDb();
     CurrentPopulation = Population.First(x => x.AfterGame == false);
 }
コード例 #3
0
        public virtual void Draw()
        {
            Player.Draw();
            ScoreSprite.Draw();

            foreach (var enemy in Enemies)
            {
                enemy.Draw();
            }
        }
コード例 #4
0
        private void SetDefaultTest()
        {
            Player      = new Player(new Vector2(300, 600), new Vector2(19, 19), "2D\\Player");
            ScoreSprite = new ScoreSprite(Player, 0);
            Population  = PopulationMapper.MapEntirePopDbToPop(PopulationRepository.GetPopulationFromDb());
            Enemies     = EnemyRepository.GetEnemiesFromDb();
            var best = PopulationRepository.GetBestPopulation();

            CurrentPopulation = PopulationMapper.MapPopDbToPop(best, best.IdObject);
        }
コード例 #5
0
        public virtual void Update()
        {
            if (GlobalVariables.KeyboardController.GetPress("R"))
            {
                Restart();
            }

            Player.Update();
            ScoreSprite.Update();

            CheckIfCurrentPopulationWon();

            CheckIfCurrentPopulationLost();

            if (CurrentPopulation != null && !Player.LoadedAiData)
            {
                LoadAiData(Player);
            }

            foreach (var enemy in Enemies)
            {
                enemy.Update();
            }
        }