Пример #1
0
        //更新
        protected override void OnUpdate()
        {
            //上昇・下降
            if (!asd.Engine.JoystickContainer.GetIsPresentAt(0))
            {
                if (asd.Engine.Keyboard.GetKeyState(asd.Keys.Up) == asd.KeyState.Hold)
                {
                    Speed += new asd.Vector2DF(-0.05f, -0.2f);
                }
                else if (asd.Engine.Keyboard.GetKeyState(asd.Keys.Down) == asd.KeyState.Hold)
                {
                    Speed += new asd.Vector2DF(0.05f, 0.2f);
                }
            }
            else
            {
                if (Joystick.GetAxisState(1) < 0.0f)
                {
                    Speed += new asd.Vector2DF(-0.05f, -0.2f);
                }
                else if (Joystick.GetAxisState(1) > 0.1f)
                {
                    Speed += new asd.Vector2DF(0.05f, 0.2f);
                }
            }

            if (WindCount > 0)
            {
                Position += new asd.Vector2DF(-0.8f, -2.0f);
                WindCount--;
            }

            Speed    += Acceleration;
            Position += Speed;

            if (Acceleration.Length > 0.01f)
            {
                Acceleration -= Acceleration.Normal * 0.01f;
            }
            else
            {
                Acceleration = new asd.Vector2DF(0.0f, 0.0f);
            }

            if (Position.Y < 25.0f)
            {
                Position = new asd.Vector2DF(Position.X, 25.0f);
            }
            ShapeOfCollige.Position = Position;
            Angle = Speed.Degree;

            base.OnUpdate();
        }