Exemplo n.º 1
0
        public static void OnBeginPlay()
        {
            Assert.IsFalse(variable.IsBool);
            Assert.IsFalse(variable.IsFloat);
            Assert.IsFalse(variable.IsString);
            Assert.IsTrue(variable.IsInt);
            Assert.IsTrue(variable.GetInt() == variableValue);

            variable.SetOnChangedCallback(VariableEvent);

            ConsoleManager.RegisterCommand(consoleCommand, "Executes a test command", ConsoleCommand);

            Assert.IsTrue(ConsoleManager.IsRegisteredVariable(consoleCommand));

            Engine.AddActionMapping(pauseResumeAction, pauseResumeKey);
            Engine.AddAxisMapping(mouseXAction, mouseXKey);
            Engine.AddAxisMapping(mouseYAction, mouseYKey);

            playerInput.AddActionMapping(playerCommandAction, playerCommandKey);

            InputComponent inputComponent = playerController.InputComponent;

            Assert.IsFalse(inputComponent.HasBindings);

            inputComponent.BindAction(pauseResumeAction, InputEvent.Pressed, PauseResume, true);
            inputComponent.BindAction(playerCommandAction, InputEvent.Pressed, PlayerCommand, true);
            inputComponent.BindAxis(mouseXAction, MouseXMessage);
            inputComponent.BindAxis(mouseYAction, MouseYMessage);

            Assert.IsTrue(inputComponent.HasBindings);
            Assert.IsTrue(inputComponent.ActionBindingsNumber == 2);

            const string removableAction = "TestRemovable";
            const string removableKey    = Keys.R;

            playerInput.AddActionMapping(removableAction, removableKey, ctrl: true, alt: true);
            playerInput.RemoveActionMapping(removableAction, removableKey);
        }