Beispiel #1
0
        public override void Act(KeyboardState kb, MouseState ms)
        {
            if (kb[Key.Escape])
            {
                CurrentWindow.SetWorld(new GameWorldStart());
                return;
            }

            long now  = GetCurrentTimeInMilliseconds();
            long diff = now - _timestampLast;

            if (!_test)
            {
                if (diff > 500)
                {
                    EnemySimple es = new EnemySimple();
                    es.SetModel("Spaceship6");
                    es.Name = "Enemy";
                    es.SetRotation(90, 0, 0);
                    es.SetPosition(HelperRandom.GetRandomNumber(-17f, 17f), 10.5f, 0);
                    es.IsCollisionObject = true;
                    AddGameObject(es);

                    _timestampLast = now;
                }
            }

            if (kb[Key.KeypadPlus])
            {
                _bloomradius        = HelperGeneral.Clamp(_bloomradius + 0.01f * KWEngine.DeltaTimeFactor, 0, 1);
                KWEngine.GlowRadius = _bloomradius;
                Console.WriteLine("Bloom radius: " + _bloomradius);
            }
            if (kb[Key.KeypadMinus])
            {
                _bloomradius        = HelperGeneral.Clamp(_bloomradius - 0.01f * KWEngine.DeltaTimeFactor, 0, 1);
                KWEngine.GlowRadius = _bloomradius;
                Console.WriteLine("Bloom radius: " + _bloomradius);
            }
        }