コード例 #1
0
ファイル: PlayerFactory.cs プロジェクト: steynh/GamingMinor
        public static void BindKeyboardControls1To(Player player)
        {
            InputManager.FunctionCall checkTextBalloon = new InputManager.FunctionCall(() => player.ParentWorld.CheckCollisionTextballoon(player));

            InputManager.AddKeyboardCallback(Keys.W, player.Jump, InputManager.InputState.WhileInputDown);
            InputManager.AddKeyboardCallback(Keys.A, player.Stop, InputManager.InputState.OnInputUp);
            InputManager.AddKeyboardCallback(Keys.A, player.WalkLeft, InputManager.InputState.WhileInputDown);
            InputManager.AddKeyboardCallback(Keys.D, player.Stop, InputManager.InputState.OnInputUp);
            InputManager.AddKeyboardCallback(Keys.D, player.WalkRight, InputManager.InputState.WhileInputDown);

            InputManager.AddKeyboardCallback(Keys.Q, player.ChangeToPreviousColor, InputManager.InputState.OnInputDown);
            InputManager.AddKeyboardCallback(Keys.E, player.ChangeToNextColor, InputManager.InputState.OnInputDown);
            InputManager.AddKeyboardCallback(Keys.R, player.Respawn, InputManager.InputState.OnInputDown);
            InputManager.AddKeyboardCallback(Keys.F, checkTextBalloon, InputManager.InputState.OnInputDown);
        }
コード例 #2
0
ファイル: PlayerFactory.cs プロジェクト: steynh/GamingMinor
        public static void BindKeyboardControls2To(Player player)
        {
            InputManager.FunctionCall checkTextBalloon = new InputManager.FunctionCall(() => player.ParentWorld.CheckCollisionTextballoon(player));

            InputManager.AddKeyboardCallback(Keys.Up, player.Jump, InputManager.InputState.WhileInputDown);
            InputManager.AddKeyboardCallback(Keys.Left, player.Stop, InputManager.InputState.OnInputUp);
            InputManager.AddKeyboardCallback(Keys.Left, player.WalkLeft, InputManager.InputState.WhileInputDown);
            InputManager.AddKeyboardCallback(Keys.Right, player.Stop, InputManager.InputState.OnInputUp);
            InputManager.AddKeyboardCallback(Keys.Right, player.WalkRight, InputManager.InputState.WhileInputDown);

            InputManager.AddKeyboardCallback(Keys.OemOpenBrackets, player.ChangeToPreviousColor, InputManager.InputState.OnInputDown);
            InputManager.AddKeyboardCallback(Keys.OemCloseBrackets, player.ChangeToNextColor, InputManager.InputState.OnInputDown);
            InputManager.AddKeyboardCallback(Keys.Enter, player.Respawn, InputManager.InputState.OnInputDown);
            InputManager.AddKeyboardCallback(Keys.P, checkTextBalloon, InputManager.InputState.OnInputDown);

            //shooting
            //InputManager.AddMouseCallback(InputManager.MouseButtons.LeftButton, player.Shoot, InputManager.InputState.OnInputDown);
        }
コード例 #3
0
ファイル: PlayerFactory.cs プロジェクト: steynh/GamingMinor
        public static void BindGamePadTo(PlayerIndex playerIndex, Player player)
        {
            InputManager.FunctionCall checkTextBalloon = new InputManager.FunctionCall(() => player.ParentWorld.CheckCollisionTextballoon(player));

            InputManager.AddGamePadCallback(playerIndex, Buttons.A, player.Jump, InputManager.InputState.WhileInputDown);
            InputManager.AddGamePadCallback(playerIndex, Buttons.LeftThumbstickLeft, player.WalkLeft, InputManager.InputState.WhileInputDown);
            InputManager.AddGamePadCallback(playerIndex, Buttons.LeftThumbstickRight, player.WalkRight, InputManager.InputState.WhileInputDown);
            InputManager.AddGamePadCallback(playerIndex, Buttons.DPadLeft, player.WalkLeft, InputManager.InputState.WhileInputDown);
            InputManager.AddGamePadCallback(playerIndex, Buttons.DPadRight, player.WalkRight, InputManager.InputState.WhileInputDown);

            InputManager.AddGamePadCallback(playerIndex, Buttons.LeftThumbstickLeft, player.Stop, InputManager.InputState.OnInputUp);
            InputManager.AddGamePadCallback(playerIndex, Buttons.LeftThumbstickRight, player.Stop, InputManager.InputState.OnInputUp);
            InputManager.AddGamePadCallback(playerIndex, Buttons.DPadLeft, player.Stop, InputManager.InputState.OnInputUp);
            InputManager.AddGamePadCallback(playerIndex, Buttons.DPadRight, player.Stop, InputManager.InputState.OnInputUp);

            InputManager.AddGamePadCallback(playerIndex, Buttons.LeftShoulder, player.ChangeToPreviousColor, InputManager.InputState.OnInputDown);
            InputManager.AddGamePadCallback(playerIndex, Buttons.RightShoulder, player.ChangeToNextColor, InputManager.InputState.OnInputDown);
            InputManager.AddGamePadCallback(playerIndex, Buttons.LeftTrigger, player.ChangeToPreviousColor, InputManager.InputState.OnInputDown);
            InputManager.AddGamePadCallback(playerIndex, Buttons.RightTrigger, player.ChangeToNextColor, InputManager.InputState.OnInputDown);

            InputManager.AddGamePadCallback(playerIndex, Buttons.Start, player.Respawn, InputManager.InputState.OnInputDown);
            InputManager.AddGamePadCallback(playerIndex, Buttons.Y, checkTextBalloon, InputManager.InputState.OnInputDown);
        }
コード例 #4
0
ファイル: LevelBuilder.cs プロジェクト: steynh/GamingMinor
        private void InitAddObjectCallbacks()
        {
            InputManager.FunctionCall addPlatform = new InputManager.FunctionCall(() => AddObject(typeof(Platform)));
            InputManager.FunctionCall addPlayerCheckpoint = new InputManager.FunctionCall(() => AddObject(typeof(PlayerCheckpoint)));
            InputManager.FunctionCall addDeadlyPlatform = new InputManager.FunctionCall(() => AddObject(typeof(DeadlyPlatform)));
            InputManager.FunctionCall addTeleporter = new InputManager.FunctionCall(() => AddObject(typeof(Teleporter)));
            InputManager.FunctionCall addTrampoline = new InputManager.FunctionCall(() => AddObject(typeof(Trampoline)));
            InputManager.FunctionCall addColorPickup = new InputManager.FunctionCall(() => AddObject(typeof(ColorPickup)));
            InputManager.FunctionCall addDisappearingPlatform = new InputManager.FunctionCall(() => AddObject(typeof(DisappearingPlatform)));
            InputManager.FunctionCall addLevelFinish = new InputManager.FunctionCall(() => AddObject(typeof(LevelFinish)));
            InputManager.FunctionCall addJumpResetter = new InputManager.FunctionCall(() => AddObject(typeof(JumpResetter)));
            InputManager.FunctionCall addTextBalloon = new InputManager.FunctionCall(() => AddObject(typeof(TextBalloon)));
            InputManager.FunctionCall addMovingPlatform = new InputManager.FunctionCall(() => AddObject(typeof(MovingPlatform)));
            InputManager.FunctionCall addShower = new InputManager.FunctionCall(() => AddObject(typeof(Shower)));

            InputManager.AddKeyboardCallback(Keys.P, addPlatform, InputManager.InputState.OnInputDown);
            InputManager.AddKeyboardCallback(Keys.C, Keys.None, addPlayerCheckpoint, InputManager.InputState.OnInputDown);
            InputManager.AddKeyboardCallback(Keys.C, Keys.LeftControl, SelectObjectForCopy, InputManager.InputState.OnInputDown);
            InputManager.AddKeyboardCallback(Keys.V, Keys.LeftControl, PasteCopiedObject, InputManager.InputState.OnInputDown);
            InputManager.AddKeyboardCallback(Keys.V, Keys.None, addTextBalloon, InputManager.InputState.OnInputDown);
            InputManager.AddKeyboardCallback(Keys.T, addTrampoline, InputManager.InputState.OnInputDown);
            InputManager.AddKeyboardCallback(Keys.H, addTeleporter, InputManager.InputState.OnInputDown);
            InputManager.AddKeyboardCallback(Keys.D, addDeadlyPlatform, InputManager.InputState.OnInputDown);
            InputManager.AddKeyboardCallback(Keys.K, addColorPickup, InputManager.InputState.OnInputDown);
            InputManager.AddKeyboardCallback(Keys.I, addDisappearingPlatform, InputManager.InputState.OnInputDown);
            InputManager.AddKeyboardCallback(Keys.M, addLevelFinish, InputManager.InputState.OnInputDown);
            InputManager.AddKeyboardCallback(Keys.J, addJumpResetter, InputManager.InputState.OnInputDown);
            InputManager.AddKeyboardCallback(Keys.N, addMovingPlatform, InputManager.InputState.OnInputDown);
            InputManager.AddKeyboardCallback(Keys.S, Keys.None, addShower, InputManager.InputState.OnInputDown);

            InputManager.AddKeyboardCallback(Keys.D1, AddNpcSpawn, InputManager.InputState.OnInputDown);
            InputManager.AddKeyboardCallback(Keys.D2, AddNpcSpawn, InputManager.InputState.OnInputDown);
            InputManager.AddKeyboardCallback(Keys.D3, AddNpcSpawn, InputManager.InputState.OnInputDown);
            InputManager.AddKeyboardCallback(Keys.D0, AddNpcSpawn, InputManager.InputState.OnInputDown);
        }