Esempio n. 1
0
        public void GameLoop(object sender, EventArgs args)
        {
            if (currentLevel.WavesAmount == 0)
            {
                currentLevel.IsCompleted = true;
                currentLevel.Particles.Add(ParticleFactory.CreateExit(currentLevel.Exit.Center));
            }
            if (player.IsDead)
            {
                ResetState();
            }
            if (currentLevel.IsCompleted && CollisionDetector.GetCollisionInfo(player.CollisionShape, currentLevel.Exit) != null)
            {
                currentLevel = LevelManager.MoveNextLevel();
                InitState();
            }

            var shouldRenderRaytracing = keyState.pressesOnPAmount % 2 == 1;
            var shouldRenderDebug      = keyState.pressesOnIAmount % 2 == 1;

            UpdateState(shouldRenderRaytracing);
            RenderPipeline.Render(currentLevel, camera, cursor.Position, shouldRenderRaytracing, shouldRenderDebug);

            AudioEngine.Update();
        }