private void HandleActionInput() { if (!_isFalling) { if (_inProximityWithOtherPlayer) { if ((_actionCooldown <= 0.0f) && (Input.GetButtonDown($"{_controllerPrefix}:Action"))) { AudioManager.PlayRandomSound("tool-swap"); SwapTools?.Invoke(_activeTool, true); } } else if ((_isAtCarousel) && (Input.GetButtonDown($"{_controllerPrefix}:Action"))) { if (_actionCooldown <= 0.0f) { AudioManager.PlayRandomSound("tool-swap"); PlayerTools nextTool = (PlayerTools)(((int)_activeTool + 1) % Enum.GetNames(typeof(PlayerTools)).Length); ActivateTool(nextTool, 0.25f); } } else if ((_activeTool == PlayerTools.Hammer) && (!_actionInProgress) && (Input.GetButtonDown($"{_controllerPrefix}:Action"))) { _actionInProgress = true; _animator.SetTrigger("Attack"); } else if ((_activeTool == PlayerTools.Pickaxe) || ((_activeTool == PlayerTools.Can) && (_actionCooldown <= 0.0f))) { _actionInProgress = Input.GetButton($"{_controllerPrefix}:Action"); } } }
private void HandleToolSwap(PlayerTools toActivate, bool originalSwapRequest) { if (originalSwapRequest) { SwapTools?.Invoke(_activeTool, false); } ActivateTool(toActivate, 0.5f); }