Пример #1
0
        public PlatformerController(Body body, CollisionType groundType, 
            Keys upKey = Keys.W, Keys leftKey = Keys.A, Keys downKey = Keys.S, Keys rightKey = Keys.D, Keys jumpKey = Keys.Space)
        {
            _body = body;
            _groundControl = new GroundController(body, leftKey, rightKey);
            _airControl = new AirController(body);

            _jumpControl = Add(new JumpController(body, jumpKey));

            Add(new KeyBinding(Keys.LeftShift, SetLightSpeed, SetDefaultState));
            Add(new KeyBinding(Keys.LeftControl, SetControlMode, SetDefaultState));

            _body.CreateContactHandler(groundType, f => SetGroundControl(), f => SetAirControl());
            SetAirControl();
        }