// Content/Blueprints/BP_MainCharacter.ts import {AC_Movement} from "../Movement/Components/AC_Movement.js"; import type {Controller, Float} from "../types.js"; import { AddMappingContext, CastToPlayController, EnhancedInputLocalPlayerSubsystem, GetGameTimeInSeconds } from "../functions.js"; import {IMC_Default} from "../Input/IMC_Default.js"; import {AC_DebugHUD} from "../Debug/Components/AC_DebugHUD.js"; export class BP_MainCharacter { // Category: "Components" MovementComponent = new AC_Movement(); // Category: "Components" DebugHUDComponent = new AC_DebugHUD(); // Category: "Debug" // Instance Editable: true ShowDebugInfo: boolean = true; // EventGraph EventReceiveControllerChanged(NewController: Controller): void { const AsPlayerController = CastToPlayController(NewController); const Target = EnhancedInputLocalPlayerSubsystem(AsPlayerController); AddMappingContext(Target, IMC_Default); } EnhancedInputActionIA_PrevDebugMode() { this.DebugHUDComponent.PreviousPage(); } EnhancedInputActionIA_NextDebugMode() { this.DebugHUDComponent.NextPage(); } EnhancedInputActionToggleHUD() { this.DebugHUDComponent.ToggleDebugHUD(); } EnhancedInputActionIA_ToggleVisualDebug() { this.DebugHUDComponent.ToggleVisualDebug(); } EventBeginPlay() { this.MovementComponent.InitializeMovementSystem(); if (this.ShowDebugInfo) { this.DebugHUDComponent.InitializeDebugHUD(this.MovementComponent); } } EventTick(DeltaTime: Float): void { if (this.ShowDebugInfo) { this.DebugHUDComponent.UpdateHUD(GetGameTimeInSeconds(), DeltaTime); } } }