// Content/Domains/Character/BP_MainCharacter.ts import { IMC_CharacterDefault } from '/Content/Domains/Character/Input/IMC_CharacterDefault.ts'; import { Cast } from '/TypeScript/Engine/Cast.ts'; import type { Controller } from '/TypeScript/Engine/Controller.ts'; import { EnhancedInputLocalPlayerSubsystem } from '/TypeScript/Engine/EnhancedInputLocalPlayerSubsystem.ts'; import type { Float } from '/TypeScript/Engine/Float.ts'; import { MathLibrary } from '/TypeScript/Engine/MathLibrary.ts'; import type { PlayerController } from '/TypeScript/Engine/PlayerController.ts'; import { Vector } from '/TypeScript/Engine/Vector.ts'; import { TengriCharacter } from '/Source/TengriPlatformer/Domains/Character/TengriCharacter.ts'; import { IA_Interact } from '/Content/Domains/Character/Input/Actions/IA_Interact.ts'; import { IA_Throw } from '/Content/Domains/Character/Input/Actions/IA_Throw.ts'; import { IA_Aim } from '/Content/Domains/Character/Input/Actions/IA_Aim.ts'; import { IMC_CharacterItemHeld } from '/Content/Domains/Character/Input/IMC_CharacterItemHeld.ts'; import { CreateWidget } from '/TypeScript/Engine/CteateWidget.ts'; import { WBP_Crosshair } from '/Content/Domains/Character/UI/WBP_Crosshair.ts'; import { CustomDefaultSkeletalMesh } from '/Content/Domains/Character/Assets/CustomDefaultSkeletalMesh.ts'; import { ETengriCameraBehavior } from '/Source/TengriPlatformer/Domains/Camera/Config/TengriCameraConfig.ts'; import { DA_CameraAiming } from '/Content/Domains/Camera/Configs/DA_CameraAiming.ts'; /** * Main Character Blueprint * Core player character with deterministic movement system * Integrates debug HUD and toast notification systems */ export class BP_MainCharacter extends TengriCharacter { // ════════════════════════════════════════════════════════════════════════════════════════ // GRAPHS // ════════════════════════════════════════════════════════════════════════════════════════ // ──────────────────────────────────────────────────────────────────────────────────────── // EventGraph // ──────────────────────────────────────────────────────────────────────────────────────── /** * Handle controller change events - sets up Enhanced Input mapping context */ EventReceiveControllerChanged(NewController: Controller): void { const controller = Cast(NewController); const system = new EnhancedInputLocalPlayerSubsystem(); if (controller) { system.AddMappingContext(IMC_CharacterDefault); } } /** * Process look input for camera rotation * @param actionValueX - Horizontal look input value * @param actionValueY - Vertical look input value */ EnhancedInputActionLookTriggered( actionValueX: Float, actionValueY: Float ): void { if ( this.CameraManager.CurrentConfig.BehaviorType === ETengriCameraBehavior.FreeLook ) { this.AddControllerYawInput(actionValueX); this.AddControllerPitchInput(actionValueY); } } /** * Process movement input for ground-based movement * @param ActionValueX - Horizontal movement input value (-1 to 1) * @param ActionValueY - Vertical movement input value (-1 to 1) */ EnhancedInputActionMoveTriggered( ActionValueX: Float, ActionValueY: Float ): void { const CalculateResultMovementInputVector = ( rightVector: Vector, forwardVector: Vector, actionValueX: Float, actionValueY: Float ): Vector => { const vec1 = new Vector( rightVector.X * actionValueX, rightVector.Y * actionValueX, 0 ); const vec2 = new Vector( forwardVector.X * actionValueY, forwardVector.Y * actionValueY, 0 ); return new Vector(vec1.X + vec2.X, vec1.Y + vec2.Y, 0); }; this.MovementComponent.SetInputVector( CalculateResultMovementInputVector( MathLibrary.GetRightVector( this.GetControlRotation().roll, 0, this.GetControlRotation().yaw ), MathLibrary.GetForwardVector(0, 0, this.GetControlRotation().yaw), ActionValueX, ActionValueY ) ); } /** * Reset movement input when move action is completed */ EnhancedInputActionMoveCompleted(): void { this.MovementComponent.SetInputVector(new Vector(0, 0, 0)); } EnhancedInputActionJumpTriggered(): void { this.MovementComponent.SetJumpInput(true); } EnhancedInputActionJumpCompleted(): void { this.MovementComponent.SetJumpInput(false); } /** * Initialize all systems when character spawns * Order: Toast → Debug → Movement (movement last as it may generate debug output) */ EventBeginPlay(): void { CreateWidget(WBP_Crosshair).AddToViewport(); } constructor() { super(new DA_CameraAiming()); this.InteractAction = IA_Interact; this.ThrowAction = IA_Throw; this.AimAction = IA_Aim; this.ItemHeldMappingContext = IMC_CharacterItemHeld; this.Mesh = new CustomDefaultSkeletalMesh(); } }