private void UseSwapTool(Vector2Int from, Vector2Int to) { boardRenderer.StopIndicatingSwap(from); // TODO: Indicate this error to the user if (toolbox.GetAvailableUses(ActiveTool) == 0) { return; } try { SimulationStep step = toolbox.UseSwapTool(ActiveTool, from, to); sessionMetrics.RegisterToolUse(ActiveTool); KickOffAnimation(step); ActiveTool = Tool.ToggleMarked; ActiveToolChanged?.Invoke(ActiveTool); UpdateUI(); } catch (InvalidOperationException) { // TODO: Indicate error to the user } }
private void UseActiveTool(Vector2Int gridPos) { // TODO: Indicate this error to the user if (toolbox.GetAvailableUses(ActiveTool) == 0) { return; } try { SimulationStep step; if (ActiveTool == Tool.Rotate3x3) { step = toolbox.UseTool(ActiveTool, gridPos, rotate3x3Button.RotationSense); } else { step = toolbox.UseTool(ActiveTool, gridPos); } sessionMetrics.RegisterToolUse(ActiveTool); KickOffAnimation(step); ActiveTool = Tool.ToggleMarked; ActiveToolChanged?.Invoke(ActiveTool); UpdateUI(); } catch (InvalidOperationException) { // TODO: Indicate error to the user } }
public void ToggleTool(Tool tool) { if (tool == ActiveTool) { ActiveTool = Tool.ToggleMarked; } else { ActiveTool = tool; } UpdateUI(); ActiveToolChanged?.Invoke(ActiveTool); if (tool == ActiveTool) { TutorialManager.Instance.CompleteActiveTutorial(); } }