🗺️ ToolsManager

ToolsManager – Component Overview

The ToolsManager handles the pet cleaning and feeding tools in the Virtual Pet Game Template. It controls the cleaning sequence (soap → sponge → shower), displays progress bars, triggers visual effects, and updates pet visuals accordingly.

🧼 What It Does

  • Manages pet cleaning phases: Soap, Sponge, Shower

  • Spawns and destroys tools

  • Updates hygiene stat and rewards EXP upon completion

  • Controls visual feedback on pet (foam, dirt levels)

  • Displays sliders for tool progress


🔧 Editable Inspector Fields

Containers

  • toolContainer – UI container where tools are spawned.

  • vfxContainer – World-space container for particle effects.

  • ActionZone – Rect defining the interaction zone for tools.

Progress Bars

  • soapBar, spongeBar, showerBar – Sliders showing cleaning progress for each phase.

EXP Settings

  • expWhenComplete – Amount of EXP granted when all cleaning steps are finished.

Feedback Objects

  • soapStepVfxObj – Activated when soap step is completed.

  • spongeStepVfxObj – Activated when sponge step is completed.

  • finalVfxObj – Activated when shower step is completed.

Audio

  • stepCompleteSfx – Sound played when a cleaning step is finished.

  • finalCompleteSfx – Sound played when cleaning is fully completed.


🛠️ CleaningToolController

The CleaningToolController component is used on each tool prefab. It defines:

  • The tool's type (Soap, Sponge, or Shower)

  • When and how it adds progress to the ToolsManager

  • Whether VFX should spawn only inside a defined action zone

📌 Tools are assigned to prefabs and spawned via ToolsManager.SpawnTool().

The FoodToolController handles pet feeding logic:

  • Spawns VFX while dragging food

  • Detects collision with the pet model

  • Increases pet hunger stat and plays feedback effects


Cleaning Flow Summary

  1. Player selects a tool (via ToolsManager.SpawnTool())

  2. Progress is added using AddProgress(CleaningToolType, delta)

  3. Each step completes when the progress reaches 100%

  4. Final step rewards EXP and updates hygiene stat


This component works tightly with PetModel, CleaningToolController, and UI elements to deliver interactive pet cleaning gameplay.

Last updated