Oakfolks Gold_1.14
Oakfolks coop game
|
Core system for cooperative mini-games with QTE integration. More...
#include <MiniGameSystem.h>
Public Member Functions | |
AMiniGameSystem () | |
Initializes the mini-game system with default components. | |
virtual void | BeginPlay () override |
Initializes snap point mappings and item lists. | |
virtual void | Tick (float DeltaTime) override |
Updates the system each frame. | |
virtual void | SetInputItem (TArray< TSubclassOf< APickableItem > > _items) |
Sets the required input items for this machine. | |
virtual void | SetQTE (UQTEConfigurationAsset *_datas) |
Sets the QTE configuration for this machine. | |
virtual void | SetOutputItem (TArray< TSubclassOf< APickableItem > > _items) |
Sets the items that will be produced upon successful completion. | |
void | StartExecute () |
Initiates the QTE execution if all conditions are met. | |
void | CallQTEReader () |
Starts the QTE sequence using the configured asset. | |
void | FinishExecute (bool _success) |
Handles QTE completion and triggers item production. | |
void | SpawnItem (int i) |
Spawns output items sequentially with delays. | |
void | Reset () |
Resets the machine to its initial state. | |
void | PartialReset (TSubclassOf< APickableItem > itemClass) |
Partially restores an item to the required list. | |
void | Interact_Implementation (AMainPlayer *Player) |
Handles player interaction without held objects. | |
void | InteractWithObject_Implementation (AMainPlayer *Player, AActor *Object) |
Handles player interaction with held objects. | |
bool | checkItemPresent () |
Validates the presence and state of deposited items. | |
int | checkItemInRecipe (APickableItem *item) |
Checks if an item is required by the current recipe. | |
void | SetPresentItem (APickableItem *item) |
Adds an item to the present items tracking. | |
void | RemoveItemFromList (int i) |
Removes an item from the required list by index. | |
bool | PlayerIsInBox (AMainPlayer *Player) |
Checks if a player is within the machine's interaction area. | |
void | OnFirstSnapPointResult (EQTEResult Result) |
void | OnFirstSnapPointResult_Implementation (EQTEResult Result) |
Callback for first snap point QTE results. | |
void | OnSecondSnapPointResult (EQTEResult Result) |
void | OnSecondSnapPointResult_Implementation (EQTEResult Result) |
Callback for second snap point QTE results. | |
void | OnFirstSnapPointProgress (const FQTEActionProgress &Progress) |
void | OnFirstSnapPointProgress_Implementation (const FQTEActionProgress &Progress) |
Callback for first snap point progress updates. | |
void | OnSecondSnapPointProgress (const FQTEActionProgress &Progress) |
void | OnSecondSnapPointProgress_Implementation (const FQTEActionProgress &Progress) |
Callback for second snap point progress updates. | |
void | OnQTEComplete (const bool bSuccess) |
void | OnQTEComplete_Implementation (const bool bSuccess) |
Callback for overall QTE completion. | |
UBillboardComponent * | GetNearestComponent (FVector ToLocation, TArray< UBillboardComponent * > Components) |
Finds the nearest snap point component to a given location. | |
![]() | |
void | Interact (AMainPlayer *Player) |
void | InteractWithObject (AMainPlayer *Player, AActor *Object) |
Object-specific interaction. | |
Public Attributes | |
UBillboardComponent * | snapPlayerPoint1 |
UBillboardComponent * | snapPlayerPoint2 |
UBillboardComponent * | outputSpawnPoint |
TMap< UBillboardComponent *, AMainPlayer * > | snapPointMap |
UBoxComponent * | inputBox |
Zone. | |
Core system for cooperative mini-games with QTE integration.
Manages player snap points, item requirements, QTE execution, and production output
AMiniGameSystem::AMiniGameSystem | ( | ) |
Initializes the mini-game system with default components.
Sets up snap points, collision box, and enables tick functionality
|
overridevirtual |
Initializes snap point mappings and item lists.
Sets up the initial state for player tracking and item management
void AMiniGameSystem::CallQTEReader | ( | ) |
Starts the QTE sequence using the configured asset.
Initializes the QTE subsystem with the assigned configuration
int AMiniGameSystem::checkItemInRecipe | ( | APickableItem * | item | ) |
Checks if an item is required by the current recipe.
Searches the required item list for a matching item type
item | The pickable item to validate against the recipe |
bool AMiniGameSystem::checkItemPresent | ( | ) |
Validates the presence and state of deposited items.
ITEM MANAGEMENT //////// Item validation and tracking
Checks if deposited items are still valid and removes invalid ones
void AMiniGameSystem::FinishExecute | ( | bool | _success | ) |
Handles QTE completion and triggers item production.
Cleans up QTE callbacks and spawns output items on success
_success | Whether the QTE was completed successfully |
UBillboardComponent * AMiniGameSystem::GetNearestComponent | ( | FVector | ToLocation, |
TArray< UBillboardComponent * > | Components ) |
Finds the nearest snap point component to a given location.
Utility method for determining optimal player positioning
ToLocation | The reference location to measure distance from |
Components | Array of billboard components to check |
void AMiniGameSystem::Interact_Implementation | ( | AMainPlayer * | Player | ) |
Handles player interaction without held objects.
INTERFACE IMPLEMENTATION //////// IInteractable methods
Manages snap point assignment and locomotion configuration
Player | The player attempting to interact with the machine |
void AMiniGameSystem::InteractWithObject_Implementation | ( | AMainPlayer * | Player, |
AActor * | Object ) |
Handles player interaction with held objects.
Validates and processes item deposits into the machine
Player | The player interacting with the machine |
Object | The object the player is holding |
void AMiniGameSystem::OnFirstSnapPointProgress_Implementation | ( | const FQTEActionProgress & | Progress | ) |
Callback for first snap point progress updates.
Receives real-time progress information for player 1
Progress | Current progress data for the QTE action |
void AMiniGameSystem::OnFirstSnapPointResult | ( | EQTEResult | Result | ) |
QTE CALLBACKS //////// QTE event responses
void AMiniGameSystem::OnFirstSnapPointResult_Implementation | ( | EQTEResult | Result | ) |
Callback for first snap point QTE results.
Handles and logs QTE action results for player 1
Result | The result of the QTE action (Success/Failure/None) |
void AMiniGameSystem::OnQTEComplete_Implementation | ( | const bool | bSuccess | ) |
Callback for overall QTE completion.
Handles the final result of the entire QTE sequence
bSuccess | Whether the complete QTE sequence was successful |
void AMiniGameSystem::OnSecondSnapPointProgress_Implementation | ( | const FQTEActionProgress & | Progress | ) |
Callback for second snap point progress updates.
Receives real-time progress information for player 2
Progress | Current progress data for the QTE action |
void AMiniGameSystem::OnSecondSnapPointResult_Implementation | ( | EQTEResult | Result | ) |
Callback for second snap point QTE results.
Handles and logs QTE action results for player 2
Result | The result of the QTE action (Success/Failure/None) |
void AMiniGameSystem::PartialReset | ( | TSubclassOf< APickableItem > | itemClass | ) |
Partially restores an item to the required list.
Used when an item is removed from the machine area
itemClass | The item class to restore to the required list |
bool AMiniGameSystem::PlayerIsInBox | ( | AMainPlayer * | Player | ) |
Checks if a player is within the machine's interaction area.
Validates player position against the input box bounds
Player | The player to check positioning for |
void AMiniGameSystem::RemoveItemFromList | ( | int | i | ) |
Removes an item from the required list by index.
Used when an item requirement has been fulfilled
i | Index of the item to remove from the required list |
void AMiniGameSystem::Reset | ( | ) |
Resets the machine to its initial state.
Restores the required item list to its original configuration
|
virtual |
Sets the required input items for this machine.
CONFIGURATION //////// System setup
Configures which items are needed to activate the mini-game
_items | Array of pickable item classes required as input |
|
virtual |
Sets the items that will be produced upon successful completion.
Configures the output items spawned after QTE success
_items | Array of pickable item classes to produce as output |
void AMiniGameSystem::SetPresentItem | ( | APickableItem * | item | ) |
Adds an item to the present items tracking.
Registers a deposited item with its class for validation
item | The pickable item to track as present |
|
virtual |
Sets the QTE configuration for this machine.
Assigns the Quick Time Event sequence to be executed
_datas | QTE configuration asset containing the sequence setup |
void AMiniGameSystem::SpawnItem | ( | int | i | ) |
Spawns output items sequentially with delays.
Recursively spawns items from the output list with timed intervals
i | Index of the item to spawn in the output array |
void AMiniGameSystem::StartExecute | ( | ) |
Initiates the QTE execution if all conditions are met.
WORKFLOW //////// Execute minigames
Checks item requirements and player positioning before starting QTE
|
overridevirtual |
Updates the system each frame.
Currently handles any per-frame logic for the mini-game system
DeltaTime | Time elapsed since the last frame in seconds |
UBillboardComponent* AMiniGameSystem::snapPlayerPoint1 |
COMPONENTS //////// Billboard snap points