square-upPart Prefab Overview

All parts — of any type and level — are stored in a single universal prefab called Part. Prefab path: Assets/StaticAssets/Prefabs/Parts/Part.prefab When the "ADD PART" command is triggered, the system creates an instance of a level one part of a random type based on this prefab.

The prefab is registered in the GameplayAssetConfig configuration and is used by the GameFactory as the base asset for part creation.

  public UpgradePartController CreatePart()
  {
      GameObject newObject = instantiator.InstantiatePrefab(gameplayAssetsConfig.partPrefab);
      return newObject.GetComponent<UpgradePartController>();
  }

Prefab Structure

The Part prefab has the following child elements:

  • Wheels – Visual representations of the wheels across four levels.

  • Turrets – Visual representations of the turrets across four levels.

  • Armors – Visual representations of the armor across four levels.

  • Ammo – Visual representation of the ammunition.

  • Rockets – Visual representation of the rockets.

  • ElectricalSparks – Visual effect that occurs when elements are combined.

  • LevelIndicator – Visual hint of the current level of the part.

Components

  • Box Collider — provides collision detection and interaction boundaries

  • Animator — controls part animations

  • CurveMover handles asynchronous movement and scaling animations.

  • DragTarget processes pointer input and smooth drag motion on a fixed plane.

  • PartLifter lifts the part vertically during interaction to improve visual clarity.

  • PartDragHandler acts as the central coordinator, connecting input events with board logic (BoardManager), movement, and lifting behavior.

  • PartVisualsController manages visual state, including backlight previews, merge effects, and level indicators.

  • PartLevelController controls upgrade logic and level progression, determines the active part model, and checks upgrade availability using persistent player progress.

  • UpgradePartController serves as the root coordinator, combining visuals, level data, and drag logic into a single modular upgrade element.

Class Relationship Diagram (Logical)

circle-info

⚠️ Important: Layer Requirement

The root Part GameObject must be assigned to the Part layer.

Failing to do so will disable all interactive behaviors, including drag and pointer input, making the part non-interactive.

Component Parameters

  • Duration defines the total time (in seconds) for both movement and scaling animations.


  • MoveDuration – Defines the total time (in seconds) for moving the object to the cursor.


  • Duration – Defines the total time (in seconds) for the animation of vertically raising and lowering the part on the board.


  • Info.Parts – A list (array) of 5 elements (Element 0 – Element 4). Each element represents an object with two fields:

    • Part Type – The type of the part (e.g., Wheel, Turret).

    • Parts – A nested list of game objects (prefabs) corresponding to the upgrade levels for this part type.


  • Particles

    • Merge FX – A reference to the ElectricalSparks object of type ParticleSystem (particles played when merging/combining parts).

  • Backlight

    • Green Mat – Material M_GreenMat (green material used to highlight parts available for merging).

    • Red Mat – Material M_RedMat (red material used to highlight parts unavailable for merging).

  • Level Indicator

    • A reference to the LevelIndicator object of type LevelIndicator (component responsible for visually displaying the part’s level).


  • playerLayer The layer on which the player is located. Used for detecting and interacting with the player character.

  • partLayer – The layer on which part objects (Part) are placed. Required for proper interaction with parts.

  • garbageLayer – The layer representing the “garbage” area or objects, where parts can be sent for removal or disposal.

Last updated