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); } }
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); }
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(); }
// 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); } }
/// <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))); }
/// <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))); }
/// <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))); }