public void Update(Vector2 newInput) { LastRawInput = CurrentRawInput; CurrentRawInput = newInput; SmashFramesRemaining = Mathf.Max(0, SmashFramesRemaining - 1); var lastInput = InputUtil.EnforceDeadZone(LastRawInput); var currentInput = InputUtil.EnforceDeadZone(CurrentRawInput); if (InputUtil.OutsideDeadZone(lastInput)) { SmashValue = Vector2.zero; return; } var diff = currentInput - lastInput; diff = InputUtil.EnforceDeadZone(diff, InputConfig.SmashThreshold); diff = InputUtil.MaxComponent(diff); if (SmashFramesRemaining > 0) { // Has recently smashed, needs to be in a different direction to change var currentDirection = DirectionalInput.GetDirection(SmashValue); var newDirection = DirectionalInput.GetDirection(diff); if (currentDirection != newDirection) { RefreshSmashValue(diff); } } else if (!InputUtil.OutsideDeadZone(diff, InputConfig.SmashThreshold)) { SmashValue = Vector2.zero; } else { RefreshSmashValue(diff); } }