示例#1
0
 void ICmpUpdatable.OnUpdate()
 {
     if (DualityApp.Keyboard.KeyHit(Key.Enter))
     {
         Scene.SwitchTo(this.gameScene);
     }
 }
示例#2
0
        void ICmpUpdatable.OnUpdate()
        {
            if (this.player == null)
            {
                return;
            }

            this.fadeValue  += (this.targetFade - this.fadeValue) * 0.01f * Time.TimeMult;
            this.memoryFade -= 0.25f * Time.SPFMult * Time.TimeMult;

            if (this.player.GameOver)
            {
                this.targetFade      = 0.0f;
                this.targetFadeColor = ColorRgba.Black;
                if (this.fadeValue <= 0.005f)
                {
                    Scene.SwitchTo(this.player.LoseScene);
                }
            }
            else if (this.player.GameWon)
            {
                this.targetFade      = 0.0f;
                this.targetFadeColor = ColorRgba.White;
                if (this.fadeValue <= 0.005f)
                {
                    Scene.SwitchTo(this.player.WinScene);
                }
            }
        }
示例#3
0
 public void OnUpdate()
 {
     if (DualityApp.Mouse.ButtonHit(MouseButton.Left) ||
         DualityApp.Keyboard.KeyHit(Key.Enter))
     {
         Scene.SwitchTo(this.GameScene);
     }
 }
示例#4
0
        public void OnUpdate()
        {
            this.enemySpawnTimer -= Time.TimeMult * Time.SPFMult;
            if (this.enemySpawnTimer <= 0.0f)
            {
                this.enemySpawnTimer += this.enemySpawnDelay * MathF.Rnd.NextFloat(0.75f, 1.0f);
                this.SpawnEnemy();
            }

            // Make some eerie space music
            if (this.backgroundMusic != null && this.playingMusic == null || this.playingMusic.Disposed)
            {
                this.playingMusic        = DualityApp.Sound.PlaySound(this.backgroundMusic);
                this.playingMusic.Looped = true;
            }

            // Add points for each second we managed to survive
            if (!this.gameOver)
            {
                this.pointTimer += Time.TimeMult * Time.SPFMult;
                if (this.pointTimer >= 1.0f)
                {
                    this.pointTimer -= 1.0f;
                    this.points     += 100;
                }
            }

            // Check for the Losing Condition
            Planet planet = this.GameObj.ParentScene.FindComponent <Planet>();

            if (planet != null)
            {
                if (!this.gameOver && planet.DetectionCounter >= planet.MaxDetectionCounter)
                {
                    DualityApp.Sound.PlaySound(this.loseSound);
                    this.gameOver = true;
                }
            }

            // Go back to to the title screen if gameover
            if (this.gameOver)
            {
                if (DualityApp.Mouse.ButtonHit(MouseButton.Left) ||
                    DualityApp.Keyboard.KeyHit(Key.Enter))
                {
                    if (this.playingMusic != null)
                    {
                        this.playingMusic.FadeOut(0.1f);
                    }
                    Scene.Current.DisposeLater();
                    Scene.SwitchTo(this.titleScene);
                }
            }
        }