Exemplo n.º 1
0
        public void UpdateInputs()
        {
            inputHashes = new int[inputs.Length];

            if (inputsDic == null)
            {
                inputsDic = new Dictionary <int, InputItem>(inputs.Length);
            }
            else
            {
                inputsDic.Clear();
            }

            if (enabledInputs == null)
            {
                enabledInputs = new Dictionary <int, bool>(inputs.Length);
            }
            else
            {
                enabledInputs.Clear();
            }

            for (int i = 0; i < inputs.Length; i++)
            {
                int hash = GoldPlayerController.InputNameToHash(inputs[i].ButtonName);
                inputHashes[i] = hash;

                inputsDic.Add(hash, inputs[i]);
                enabledInputs.Add(hash, false);
            }
        }
Exemplo n.º 2
0
        protected override void OnInitialize()
        {
            // If the camera head is null, complain.
            if (cameraHead == null)
            {
                Debug.LogError($"'{PlayerController.gameObject.name}' needs to have Camera Head assigned in the Camera settings!");
                return;
            }

            if (IsCameraNull)
            {
                Debug.LogError($"'{PlayerController.gameObject.name}' needs to have a Target Camera assigned in the Camera Settings!");
                return;
            }

            lookHash = GoldPlayerController.InputNameToHash(input_Look);
            zoomHash = GoldPlayerController.InputNameToHash(zoomInput);

            originalFieldOfView = CameraFieldOfView;
            zoomFieldOfView     = originalFieldOfView;
            zoomTimer           = zoomOutTime;

            // Lock the cursor, if it should.
            LockCursor(shouldLockCursor);

            // Set the original head rotation to the one on the camera head.
            originalHeadRotation = cameraHead.localRotation;

            // Initialize the FOV kick module.
            fieldOfViewKick.Initialize(PlayerController, PlayerInput);
        }
Exemplo n.º 3
0
        protected virtual void Awake()
        {
#if OBSOLETE
            Debug.LogError(gameObject.name + " has GoldPlayerInteraction attached. It will be removed on build. Please remove this component if you don't intend to use it.", gameObject);
#endif

            interactHash = GoldPlayerController.InputNameToHash(interactInput);

            // Apply the trigger interaction.
            SetTriggerInteraction();
        }
Exemplo n.º 4
0
        // Add all actions to the actions dictionary.
        public void UpdateActions()
        {
            if (actions == null)
            {
                return;
            }

            actionsDictionary = new Dictionary <int, InputAction>();
            for (int i = 0; i < actions.Length; i++)
            {
                actionsDictionary.Add(GoldPlayerController.InputNameToHash(actions[i].actionName), actions[i].action);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Gets a Vector2 input value.
 /// It's much more recommended to cache a hash using <see cref="GoldPlayerController.InputNameToHash"/>
 /// and call <see cref="GetAxisRaw(int)"/> instead.
 /// </summary>
 /// <param name="action"></param>
 /// <returns></returns>
 protected Vector2 GetVector2Input(string action)
 {
     return(GetVector2Input(GoldPlayerController.InputNameToHash(action)));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Equivalent to Input's GetAxisRaw function.
 /// It's much more recommended to cache a hash using <see cref="GoldPlayerController.InputNameToHash"/>
 /// and call <see cref="GetAxisRaw(int)"/> instead.
 /// </summary>
 /// <param name="axisName">The axis name you want to get.</param>
 protected float GetAxisRaw(string axisName)
 {
     return(GetAxisRaw(GoldPlayerController.InputNameToHash(axisName)));
 }
Exemplo n.º 7
0
 /// <summary>
 /// Equivalent to Input's GetButtonUp/GetKeyUp function.
 /// It's much more recommended to cache a hash using <see cref="GoldPlayerController.InputNameToHash"/>
 /// and call <see cref="GetButtonUp(int)"/> instead.
 /// </summary>
 /// <param name="buttonName">The button name you want to get.</param>
 protected bool GetButtonUp(string buttonName)
 {
     return(GetButtonUp(GoldPlayerController.InputNameToHash(buttonName)));
 }