Exemplo n.º 1
0
 public void OnSceneLoaded(Scene scene, LoadSceneMode mode)
 {
     InputActionAsset.Disable();
     _camera = Camera.main;
     SetLensDistortion(CurrentOptions.lensDistortion);
     InputActionAsset.Enable();
 }
Exemplo n.º 2
0
 void Start()
 {
     dfState      = DFStates.BEFORE_GAME;
     playersInfos = PlayersManager.instance.playersList;
     dragonsActions.Enable();
     AssignControllerToPlayer();
 }
Exemplo n.º 3
0
    private void Awake()
    {
        var playerActionmap = inputActionsAsset.actionMaps[0]; // player 1

        moveLeftAction  = playerActionmap.FindAction("Move Left");
        moveRightAction = playerActionmap.FindAction("Move Right");
        moveUpAction    = playerActionmap.FindAction("Move Up");
        moveDownAction  = playerActionmap.FindAction("Move Down");
        interactAction  = playerActionmap.FindAction("Interact");

        inputActionsAsset.Enable();
    }
Exemplo n.º 4
0
 public void SwitchActions(string name)
 {
     playerInput.SwitchActions(name);
     ActionMapName = name;
     ActionAsset.Disable();
     ActionAsset.Enable();
 }
Exemplo n.º 5
0
 public void DeactivateMenu()
 {
     Time.timeScale = 1f;
     pauseMenu.SetActive(false);
     inputActionAsset.Enable();
     menuIsOpen = false;
 }
Exemplo n.º 6
0
    private void BindInput(bool p_AreEnabled)
    {
        if (m_InputAsset == null)
        {
            return;
        }

        if (p_AreEnabled)
        {
            m_InputAsset.FindAction("Player/Movement").performed += Move;
            m_InputAsset.FindAction("Player/Movement").canceled  += Move;

            m_InputAsset.FindAction("Player/Fire").performed += Shoot;
            m_InputAsset.FindAction("Player/Fire").canceled  += StopShoot;

            m_InputAsset.Enable();
        }
        else
        {
            m_InputAsset.FindAction("Player/Movement").performed -= Move;
            m_InputAsset.FindAction("Player/Movement").canceled  -= Move;

            m_InputAsset.FindAction("Player/Fire").performed -= Shoot;
            m_InputAsset.FindAction("Player/Fire").canceled  -= StopShoot;
            m_InputAsset.Disable();
        }
    }
Exemplo n.º 7
0
 public void Start()
 {
     playerActions = GetComponent <PlayerInput>().actions;
     moveAction    = playerActions.FindAction("Move");
     buttonControl = (ButtonControl)moveAction.controls[0];
     playerActions.Enable();
     ground = LayerMask.GetMask("Ground");
 }
 private void Start()
 {
     inputAsset = GetComponent <PlayerInput>().actions;
     if (inputAsset != null)
     {
         inputAsset.Enable();
     }
 }
 private void Start()
 {
     try
     {
         inputActionsAsset.FindAction($"{actionMap}/{action}").performed += AreaActionTrigger_performed;
         inputActionsAsset.Enable();
     }
     catch (NullReferenceException e)
     {
         throw new Exception("Conversation System: No input action asset has been set on your area action trigger!");
     }
 }
Exemplo n.º 10
0
    private void Awake()
    {
        rb = GetComponent <Rigidbody> ();
        campfireComponent = CampFire.GetComponent <FireController> ();
        torchComponent    = Torch.GetComponent <Torch> ();
        anim              = GetComponent <Animator> ();
        audio             = GetComponent <AudioSource> ();
        tempRotationSpeed = rotationSpeed;

        inputBindings.Enable();
        move     = inputBindings.FindAction("Move");
        interact = inputBindings.FindAction("Interact");
    }
Exemplo n.º 11
0
 private void Start()
 {
     try
     {
         // Set up event handler to invoke when a button is pressed
         inputActionsAsset.FindActionMap(actionMap).FindAction(action).performed += AreaActionTrigger_performed;
         inputActionsAsset.Enable();
     }
     catch (NullReferenceException e)
     {
         throw new Exception("Conversation System: No input action asset has been set on your area action trigger!");
     }
 }
Exemplo n.º 12
0
    //Function: InitInputSystem
    //Initializes the required input actions found in <inputActions> and sets event callbacks.
#if USE_INPUT_SYSTEM
    void InitInputSystem()
    {
        inputActions.Enable();
        inputActions.FindActionMap("Rig").FindAction("Look").started                    += context => { looking = true; };
        inputActions.FindActionMap("Rig").FindAction("Look").canceled                   += context => { looking = false; };
        inputActions.FindActionMap("Rig").FindAction("Move").started                    += context => { moving = true; };
        inputActions.FindActionMap("Rig").FindAction("Move").canceled                   += context => { moving = false; };
        inputActions.FindActionMap("Controller").FindAction("Move").started             += context => { controllerMoving = true; };
        inputActions.FindActionMap("Controller").FindAction("Move").canceled            += context => { controllerMoving = false; };
        inputActions.FindActionMap("Controller").FindAction("ToggleRotation").performed += context => { toggleRotation = !toggleRotation; };
        inputActions.FindActionMap("Controller").FindAction("Reset").performed          += context => { simulator.ResetControllers(); };

        inputActions.FindActionMap("Controller").FindAction("SwitchController").performed += context => {
            switchController     = !switchController;
            simulator.switchHand = switchController;
        };

        inputActions.FindActionMap("Controller").FindAction("ToggleController").performed += context => {
            controllersActive     = !controllersActive;
            simulator.handsActive = controllersActive;
        };

        inputActions.FindActionMap("Controller").FindAction("SwitchAxis").started += context => {
            switchAxis = true;
            simulator.switchHandAxis = switchAxis;
        };

        inputActions.FindActionMap("Controller").FindAction("SwitchAxis").canceled += context => {
            switchAxis = false;
            simulator.switchHandAxis = switchAxis;
        };

        inputActions.FindActionMap("XRInput").FindAction("Trigger").started  += context => { VRSimulatorInputInterface.SetTriggerState(switchController, true); };
        inputActions.FindActionMap("XRInput").FindAction("Trigger").canceled += context => { VRSimulatorInputInterface.SetTriggerState(switchController, false); };

        inputActions.FindActionMap("XRInput").FindAction("Grip").started  += context => { VRSimulatorInputInterface.SetGripState(switchController, true); };
        inputActions.FindActionMap("XRInput").FindAction("Grip").canceled += context => { VRSimulatorInputInterface.SetGripState(switchController, false); };

        inputActions.FindActionMap("XRInput").FindAction("PrimaryButton").started  += context => { VRSimulatorInputInterface.SetPrimaryState(switchController, true); };
        inputActions.FindActionMap("XRInput").FindAction("PrimaryButton").canceled += context => { VRSimulatorInputInterface.SetPrimaryState(switchController, false); };

        inputActions.FindActionMap("XRInput").FindAction("SecondaryButton").started  += context => { VRSimulatorInputInterface.SetSecondaryState(switchController, true); };
        inputActions.FindActionMap("XRInput").FindAction("SecondaryButton").canceled += context => { VRSimulatorInputInterface.SetSecondaryState(switchController, false); };

        inputActions.FindActionMap("XRInput").FindAction("Stick").started  += context => { stickActive = true; };
        inputActions.FindActionMap("XRInput").FindAction("Stick").canceled += context => {
            stickActive = false;
            VRSimulatorInputInterface.SetPrimary2D(switchController, Vector2.zero);
        };
    }
Exemplo n.º 13
0
        private void Start()
        {
            builderManager = GetComponent <BuilderManager>();

            var desktopMap = inputAsset.FindActionMap("Desktop");

            aim = desktopMap.FindAction("Aim");
            put = desktopMap.FindAction("Put");

            aim.performed += Aim;
            put.performed += Put;

            inputAsset.Enable();
        }
Exemplo n.º 14
0
        private void Start()
        {
            Debug.Log("Conversation UI initialized...");

            try
            {
                inputActions.FindActionMap("Conversation").FindAction("Next", true).performed += NextControl_performed;
                inputActions.Enable();
            }
            catch (NullReferenceException)
            {
                Debug.LogError("Conversation System: No InputActionAsset is set in the conversation UI prefab. Please set it!");
            }
        }
Exemplo n.º 15
0
 void OnEnable()
 {
     asset.Enable();
     foreach (var link in links)
     {
         if (!link.State)
         {
             asset.FindActionMap(link.Name).Disable();
         }
         else
         {
             asset.FindActionMap(link.Name).Enable();
         }
     }
 }
Exemplo n.º 16
0
 // Start is called before the first frame update
 void Start()
 {
     Assert.IsNotNull(guiSkin);
     Assert.IsNotNull(guiStylePLAY);
     Assert.IsNotNull(guiStyleLOGO);
     Assert.IsNotNull(guiStyleINFO);
     Assert.IsNotNull(guiStyleCONF);
     currentSelection = ButtonSelection.LOGO;
     inputActions.actionMaps[0].actions[0].performed += OnUp;
     inputActions.actionMaps[0].actions[1].performed += OnDown;
     inputActions.actionMaps[0].actions[2].performed += OnLeft;
     inputActions.actionMaps[0].actions[3].performed += OnRight;
     inputActions.actionMaps[0].actions[4].performed += OnConfirmSelection;
     inputActions.Enable();
 }
Exemplo n.º 17
0
        private void Start()
        {
            physics = GetComponent <Rigidbody>();
            touch   = GetComponent <TouchManipulation>();

            look         = InputActions["Look"];
            clampedPitch = InputActions["Clamped Pitch"];
            resetPitch   = InputActions["Reset Pitch"];
            strafe       = InputActions["Strafe"];
            scrollStrafe = InputActions["Scroll Strafe"];
            thrust       = InputActions["Thrust"];
            InputActions.Enable();

            Cursor.lockState = CursorLockMode.Locked;
        }
Exemplo n.º 18
0
    private void Awake()
    {
        var inputActions = inputActionAsset.FindActionMap(Player.INPUT_MAP);

        playerAttack        = inputActions.FindAction(Player.ATTACK_ACTION);
        playerJumpAttack    = inputActions.FindAction(Player.JUMP_ATTACK_ACTION);
        playerAltAttack     = inputActions.FindAction(Player.ALT_ATTACK_ACTION);
        playerAltJumpAttack = inputActions.FindAction(Player.ALT_JUMP_ATTACK_ACTION);
        inputActionAsset.Enable();
        animator = GetComponent <Animator>();
        hbc      = healthBarControl.GetComponent <HealthBarController>();
        hitCollider.gameObject.SetActive(false);
        hitCollider.transform.position = new Vector3(0, 1, HIT_AREA_OFFSET + LOCAL_HIT_AREA_OFFSET);
        IsAttacking     = false;
        IsJumpAttacking = false;
        IsRunning       = false;
        Equipment       = new Equipment(gameObject);
        StartCoroutine(EquipCoroutine());
        Health = STARTING_HEALTH;
    }
Exemplo n.º 19
0
        private void Awake()
        {
            // Init references
            if (!m_Movement)
            {
                m_Movement = GetComponent <DirectionalMovement>();
            }
            if (!m_Detection)
            {
                m_Detection = GetComponent <DetectionSight>();
            }

            /* Setup input bindings */

            InputAction moveAction = m_Controls.FindAction("Player/Move");

            moveAction.performed += (ctx) => { m_MovementDirection = ctx.ReadValue <Vector2>(); };
            moveAction.canceled  += (ctx) => { m_MovementDirection = Vector2.zero; };

            m_Controls.Enable();
        }
Exemplo n.º 20
0
    private void BindInputs(bool p_AreEnebled)
    {
        if (m_InputManger == null)
        {
            return;
        }
        if (p_AreEnebled)
        {
            m_InputManger.FindAction($"{nameMap}/Move").performed += Move;
            m_InputManger.FindAction($"{nameMap}/Move").canceled  += Move;

            m_InputManger.Enable();
        }
        else
        {
            m_InputManger.FindAction($"{nameMap}/Move").performed -= Move;
            m_InputManger.FindAction($"{nameMap}/Move").canceled  -= Move;

            m_InputManger.Disable();
        }
    }
Exemplo n.º 21
0
        protected override void Start()
        {
            base.Start();

            m_InputActions.Enable();
            m_MoveAction        = m_InputActions["Player/Move"];
            m_RunAction         = m_InputActions["Player/Run"];
            m_LookAction        = m_InputActions["Player/Look"];
            m_JumpAction        = m_InputActions["Player/Jump"];
            m_FlyAction         = m_InputActions["Player/Fly"];
            m_FlyDownAction     = m_InputActions["Player/Fly Down"];
            m_CursorStateAction = m_InputActions["Player/Cursor State"];

            m_Camera          = GetComponentInChildren <Camera>();
            m_CameraTransform = m_Camera.GetComponent <Transform>();
            m_FluidInteractor = GetComponent <FluidInteractor>();

            m_FirstPersonLook.Initialize(m_Transform, m_CameraTransform, true);
            m_HeadBob.Initialize(m_CameraTransform);
            m_JumpBob.Initialize();

            m_OriginalCameraPosition = m_CameraTransform.localPosition;
            m_StepCycle = 0f;
            m_NextStep  = m_StepCycle * 0.5f;

            m_RunAction.performed         += SwitchRunMode;
            m_JumpAction.performed        += SwitchJumpMode;
            m_FlyAction.performed         += SwitchFlyMode;
            m_FlyDownAction.performed     += SwitchFlyDownMode;
            m_CursorStateAction.performed += SwitchCursorState;

            BlockInteraction interaction = GetComponent <BlockInteraction>();

            interaction.Initialize(m_Camera, this);
            interaction.enabled = true;
        }
Exemplo n.º 22
0
            public void Enable()
            {
                var hAction = m_hInput.FindAction(InputButtonName.axis);

                hAction.performed += OnAxis;
                hAction.canceled  += OnAxis;

                hAction            = m_hInput.FindAction(InputButtonName.axis2);
                hAction.performed += OnAxis2;
                hAction.canceled  += OnAxis2;

                hAction            = m_hInput.FindAction(InputButtonName.dPadUp);
                hAction.performed += OnDPadUp;
                hAction.canceled  += OnDPadUp;

                hAction            = m_hInput.FindAction(InputButtonName.dPadDown);
                hAction.performed += OnDPadDown;
                hAction.canceled  += OnDPadDown;

                hAction            = m_hInput.FindAction(InputButtonName.dPadLeft);
                hAction.performed += OnDPadLeft;
                hAction.canceled  += OnDPadLeft;

                hAction            = m_hInput.FindAction(InputButtonName.dPadRight);
                hAction.performed += OnDPadRight;
                hAction.canceled  += OnDPadRight;

                hAction            = m_hInput.FindAction(InputButtonName.north);
                hAction.performed += OnNorth;
                hAction.canceled  += OnNorth;

                hAction            = m_hInput.FindAction(InputButtonName.south);
                hAction.performed += OnSouth;
                hAction.canceled  += OnSouth;

                hAction            = m_hInput.FindAction(InputButtonName.west);
                hAction.performed += OnWest;
                hAction.canceled  += OnWest;

                hAction            = m_hInput.FindAction(InputButtonName.east);
                hAction.performed += OnEast;
                hAction.canceled  += OnEast;

                hAction            = m_hInput.FindAction(InputButtonName.l1);
                hAction.performed += OnL1;
                hAction.canceled  += OnL1;

                hAction            = m_hInput.FindAction(InputButtonName.l2);
                hAction.performed += OnL2;
                hAction.canceled  += OnL2;

                hAction            = m_hInput.FindAction(InputButtonName.l3);
                hAction.performed += OnL3;
                hAction.canceled  += OnL3;

                hAction            = m_hInput.FindAction(InputButtonName.r1);
                hAction.performed += OnR1;
                hAction.canceled  += OnR1;

                hAction            = m_hInput.FindAction(InputButtonName.r2);
                hAction.performed += OnR2;
                hAction.canceled  += OnR2;

                hAction            = m_hInput.FindAction(InputButtonName.r3);
                hAction.performed += OnR3;
                hAction.canceled  += OnR3;

                hAction            = m_hInput.FindAction(InputButtonName.start);
                hAction.performed += OnStart;
                hAction.canceled  += OnStart;

                hAction            = m_hInput.FindAction(InputButtonName.select);
                hAction.performed += OnSelect;
                hAction.canceled  += OnSelect;

                hAction            = m_hInput.FindAction(InputButtonName.confirm);
                hAction.performed += OnConfirm;
                hAction.canceled  += OnConfirm;

                hAction            = m_hInput.FindAction(InputButtonName.cancel);
                hAction.performed += OnCancel;
                hAction.canceled  += OnCancel;

                m_hInput.Enable();
            }
 void OnEnable()
 {
     actions.Enable();
 }
Exemplo n.º 24
0
 private void OnEnable()
 {
     controls.Enable();
 }
Exemplo n.º 25
0
 void OnEnable()
 {
     inputActionAsset.Enable();
 }
Exemplo n.º 26
0
 private void OnEnable()
 {
     pi.Enable();
 }
 private void OnEnable()
 {
     _ipt.Enable();
 }
Exemplo n.º 28
0
 void OnEnable() => InputAsset.Enable();
Exemplo n.º 29
0
 public void Enable(Action <object, InputActionChange> action)
 {
     _asset.Enable();
     InputSystem.onActionChange += action;
 }
 private void OnEnable()
 {
     map.Enable();
 }