protected virtual void ExecuteInput(Vector2Int?direction = null) { Vector2Int actionDirection; if (!direction.HasValue) { actionDirection = _currentInput; } else { actionDirection = direction.Value; } // If the direction is null/zero return if (actionDirection == Vector2Int.zero) { return; } // Try to move to the target position var targetPosition = _gridObject.m_GridPosition + actionDirection; MovementResult movementResult = _gridMovement.TryMoveToNeighborInPosition(targetPosition, m_AnimateMovement, m_RotateTowardsDirection); // Queue the desired input if the movement is currently in cooldown if (movementResult == MovementResult.Cooldown) { _queuedInput = _currentInput; return; } // If movement was succesful or failed for some other reason we remove the current input _currentInput = Vector2Int.zero; }