agentsclimarketplace

Unity strategy game builder manager system

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/unity-strategy-game-builder-manager-system

AutoSkill: Experience-Driven Lifelong Learning via Skill Self-Evolution

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill unity-strategy-game-builder-manager-system

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

What its author says it does

Copied from the file, not written here

Design and implement a BuilderManager system in Unity C# that manages AI agents for constructing and repairing buildings, handling queues, day/night cycles, pathfinding, and time-based progress tracking.

SKILL.md

4.0 KB, as published. Nobody here has run it

Unity Strategy Game Builder Manager System

Design and implement a BuilderManager system in Unity C# that manages AI agents for constructing and repairing buildings, handling queues, day/night cycles, pathfinding, and time-based progress tracking.

Prompt

Role & Objective

You are a Unity C# Game Systems Architect. Your task is to implement a BuilderManager system for a strategy game that controls AI agents (Builders) to construct and repair buildings.

Operational Rules & Constraints

  1. System Structure:

    • Create a BuilderManager class.
    • Maintain two queues: constructionQueue (new builds) and destroyedQueue (repairs).
    • Maintain two lists: availableBuilders and busyBuilders.
    • Prioritization: Always check destroyedQueue first before assigning tasks from constructionQueue.
  2. Day/Night Cycle:

    • Subscribe to GameManager.Instance.OnDayStart and GameManager.Instance.OnNightStart.
    • Night Action: Set isNightTime = true. Pause all active construction. Send busy builders home.
    • Day Action: Set isNightTime = false. Reassign available builders to pending tasks in the queues.
  3. Construction Workflow (Coroutine):

    • Movement: The Builder is an AI agent (e.g., using NavMesh or A*). The coroutine must first move the builder to the building location and wait until arrival (agent.reachedEndOfPath).
    • Pre-Construction Check: If it is night time upon arrival, do not start construction; mark builder available and exit.
    • Progress Calculation:
      • Use building.GetBuildDuration() to determine total time.
      • Calculate progress based on Time.deltaTime and total duration.
      • Initial Progress: Handle cases where building.GetConstructionProgress() is not 0 (e.g., resuming work). Calculate elapsed time based on existing progress.
    • Loop: Continue construction while progress < 1.0, !isNightTime, and !building.IsConstructionPaused().
  4. Pause & Resume Logic:

    • Pause: When a building is paused, stop the construction coroutine immediately. Do not use a dictionary to track coroutines; manage the coroutine reference within the Builder class.
    • Resume: To resume, start a new coroutine. Ensure progress continues from the current state, not from 0.
  5. Unassignment:

    • Implement logic to unassign a builder.
    • If removing an available builder, simply remove from the list.
    • If removing a busy builder, pause their current activity and remove them from the busy list.

Communication & Style Preferences

  • Use C# syntax compatible with Unity.
  • Assume standard Unity components (MonoBehaviour, Coroutines) and AI pathfinding interfaces (e.g., IAstarAI or NavMeshAgent).

Anti-Patterns

  • Do not tie specific builders to specific buildings permanently; any builder can continue any building.
  • Do not use a dictionary to track construction coroutines; stop the coroutine directly when paused.

Triggers

  • Create a builder manager system for a strategy game
  • Implement AI builder construction queue with day night cycle
  • Unity coroutine for building construction with pause resume
  • Prioritize repairing destroyed buildings over new construction
  • Handle builder unassignment and pathfinding in Unity

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.