/PlacementSystem

A free builder (building placement system) plugin for Unreal Engine

Primary LanguageC++

Placement System Plugin for Unreal Engine (C++ Code Plugin)

Watch tutorial on youtube here !

A code plugin that allows very basic city building functionallities.

Contains:

  • PlacementManagerComponent : A component that allows comunication to the system (e.g placing objects, replacing and checking for selection)
  • PlacmentActor : an actor that can be spawned to the scene by PlacementManagerComponent
  • GridManager : an Actor that is responsible for grid and reserve system (so two objects can not be plcaed at the same place at the same time)

PlacementManagerComponent

the main component that can be added to the player and it is the main way to comunicate with the system.

Placment

the process of adding an object to the scene, proccess simplified into 3 steps (functions):
  • Placement_Start() : starts the placement process takes in an actor (PlacementActor).
  • Placement_Accept() : places the actor that been taken in Placement start and places in the currrent location and finishes the placement process.
  • Placement_Cancel() : cancels the placement process.

Replacment

the process of re-positioning an object that already spawned to the scene proccess simplified into 3 steps (functions):
  • Replacement_Start() : starts the Replacement process takes in an actor (PlacementActor) and starts to replace that actor.
  • Replacement_Accept() : places the actor that been taken in Replacement start and places in the currrent location and finishes the Replacement process.
  • places the actor that been taken in Replacement start to its original locatio and cancels the Replacement proces.

Select

Act of Selecting the actor under the cursor :
  • SelectUnderCursor() : is a function that selects actor under the cursor and calls OnSelected for the actor, and unselects the already selceted ons (calls OnUnselected for that actor).

PlacementActor

An actor that can be placed to the scene by PlacementManagerComponent.

Functions

  • RegisterForReplacement()
  • RemoveBuilding()

Calllback Functions

  • OnPreviewPlacement() : called when the actor is spawned to the scene(called on placment_start for the actor) and not yet accepted (placment_accept() not yet called for the actor
  • OnPlaced() : called when the actor spawned (called for actor when Placement_accept called
  • OnHover() : Called when the actor hovered by the mouse
  • OnUnhover() : Called when the actor unhovered
  • OnSelected() : called when the the actor selected
  • OnUnselected() : called when this actor is un selected
  • OnPlacementPorcessValidation() : called on tick() for validating the current location in both Placement and replacement processes
  • OnReplacement_Start() : called when replacement process started for this actor
  • OnReplaced() : called when the replacement process is finished for this actor (called for both Replacement_accept and Replacement_cancel )

GridManager

An Actor that is responsible for grid and reserving places to actors so two actors can not be positioned at the same place at the same time (one cells can not be reserved more than one PlacementActor)

Functions

  • DrawCells() : draws cells