All files / types player-visual.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195                                                                                                                                                                                                                                                                                                                                                                                                     
/**
 * Player visual component types for unified 3D player representation
 *
 * This module defines TypeScript interfaces for the unified Player3D component
 * used across combat and training screens, ensuring visual consistency and
 * proper integration with the combat system.
 *
 * @module types/player-visual
 * @category Type Definitions
 * @korean 플레이어시각타입
 */
 
import type { BodyFacing } from "../systems/animation/core/types";
import type { PlayerArchetype, TrigramStance } from "./common";
import type { FacialDamageState, FacialExpression } from "./facial";
 
/**
 * Balance state representing player stability in combat.
 * Drives visual indicators and affects combat effectiveness.
 *
 * @category Combat States
 * @korean 균형상태
 */
export type BalanceState = "READY" | "SHAKEN" | "VULNERABLE" | "HELPLESS";
 
/**
 * Player animation states for 3D model pose and movement.
 *
 * @category Animation
 * @korean 애니메이션상태
 */
export type PlayerAnimation =
  | "idle"
  | "attack"
  | "defend"
  | "hit"
  | "stance_change"
  | "stance_side_switch"
  | "technique_execute"
  | "walk"
  | "run" // Running animation (달리기)
  | "block"
  | "counter"
  | "death"
  // Fall animations (낙법)
  | "fall_forward"
  | "fall_backward"
  | "fall_side_left"
  | "fall_side_right"
  | "step_forward"
  | "step_back"
  | "step_left"
  | "step_right"
  | "step_forward_left"
  | "step_forward_right"
  | "step_back_left"
  | "step_back_right"
  // Stance-specific idle animations (팔괘 자세 애니메이션)
  | "stance_geon" // ☰ 건 (Heaven) - Forward stance
  | "stance_tae" // ☱ 태 (Lake) - Cat stance
  | "stance_li" // ☲ 리 (Fire) - Fighting stance
  | "stance_jin" // ☳ 진 (Thunder) - Horse stance
  | "stance_son" // ☴ 손 (Wind) - Crane stance
  | "stance_gam" // ☵ 감 (Water) - Back stance
  | "stance_gan" // ☶ 간 (Mountain) - Defensive stance
  | "stance_gon"; // ☷ 곤 (Earth) - Low stance
 
/**
 * Unified props for Player3D visual component.
 *
 * This interface provides all properties needed to render a player
 * in both combat and training contexts with full state visualization.
 *
 * @category Component Props
 * @korean 플레이어3D속성
 */
export interface Player3DUnifiedProps {
  /** Unique identifier for the player @korean 플레이어ID */
  readonly playerId: string;
  /** Player archetype determining visual style and theming @korean 원형 */
  readonly archetype: PlayerArchetype;
  /** Current trigram stance (1 of 8) @korean 현재자세 */
  readonly stance: TrigramStance;
  /**
   * Stance laterality (left or right foot forward)
   * - "left": Left foot forward (왼발서기 - Oenbal Seogi)
   * - "right": Right foot forward (오른발서기 - Oreun Bal Seogi)
   * @korean 측면성
   */
  readonly laterality?: "left" | "right";
  /** 3D world position [x, y, z] @korean 위치 */
  readonly position: [number, number, number];
  /** Rotation in radians (Y-axis) @korean 회전 */
  readonly rotation: number;
  /** Current health points (0-maxHealth) @korean 건강 */
  readonly health: number;
  /** Maximum health points @korean 최대건강 */
  readonly maxHealth: number;
  /** Current stamina points (0-100) @korean 체력 */
  readonly stamina: number;
  /** Current Ki/energy points (0-100) @korean 기 */
  readonly ki: number;
  /** Pain level affecting balance and performance (0-100) @korean 통증 */
  readonly pain: number;
  /** Balance/stability state in combat @korean 균형상태 */
  readonly balance: BalanceState;
  /** Consciousness level (0-100) @korean 의식 */
  readonly consciousness: number;
  /** Blood loss amount (0-100) @korean 출혈 */
  readonly bloodLoss?: number;
  /** Whether player is currently blocking @korean 방어중 */
  readonly isBlocking: boolean;
  /** Whether player is stunned @korean 기절 */
  readonly isStunned?: boolean;
  /** Whether player is countering @korean 반격중 */
  readonly isCountering?: boolean;
  /** Current animation state @korean 현재애니메이션 */
  readonly currentAnimation: PlayerAnimation;
  /** Whether rendering for mobile device @korean 모바일여부 */
  readonly isMobile: boolean;
  /** Player display name (Korean and English) @korean 이름 */
  readonly name?: {
    readonly korean: string;
    readonly english: string;
  };
  /** Scale multiplier for the model (default: 1) @korean 크기 */
  readonly scale?: number;
  /** Whether to show Html overlay with stats @korean 세부정보표시 */
  readonly showDetails?: boolean;
  /** Direction the player is facing @korean 방향 */
  readonly facing?: "left" | "right";
  /** Whether to show health bar @korean 체력바표시 */
  readonly showHealthBar?: boolean;
  /** Whether to show stance indicator @korean 자세표시기표시 */
  readonly showStanceIndicator?: boolean;
  /** Callback when animation completes @korean 애니메이션완료콜백 */
  readonly onAnimationComplete?: () => void;
  /** Current facial expression @korean 얼굴표정 */
  readonly facialExpression?: FacialExpression;
  /** Facial damage state @korean 얼굴손상 */
  readonly facialDamage?: FacialDamageState;
  /** Whether to enable facial expressions @korean 표정사용 */
  readonly enableFacialExpressions?: boolean;
  /** Whether to enable eye tracking @korean 눈추적사용 */
  readonly enableEyeTracking?: boolean;
  /** Opponent position for eye tracking @korean 상대위치 */
  readonly opponentPosition?: [number, number, number];
  /** Body facing state for automatic opponent tracking @korean 몸향하기상태 */
  readonly bodyFacing?: BodyFacing;
  /** Callback to update body facing state @korean 몸향하기업데이트콜백 */
  readonly onBodyFacingUpdate?: (bodyFacing: BodyFacing) => void;
}
 
/**
 * Props for PlayerStateIndicators component (Html overlay)
 *
 * @category Component Props
 * @korean 상태표시기속성
 */
export interface PlayerStateIndicatorsProps {
  /** Current health (0-maxHealth) @korean 건강 */
  readonly health: number;
  /** Maximum health @korean 최대건강 */
  readonly maxHealth: number;
  /** Current stamina (0-100) @korean 체력 */
  readonly stamina: number;
  /** Current Ki (0-100) @korean 기 */
  readonly ki: number;
  /** Balance state @korean 균형상태 */
  readonly balance: BalanceState;
  /** Consciousness level (0-100) @korean 의식 */
  readonly consciousness: number;
  /** Pain level (0-100) @korean 통증 */
  readonly pain?: number;
  /** Blood loss (0-100) @korean 출혈 */
  readonly bloodLoss?: number;
  /** Mobile responsive mode @korean 모바일여부 */
  readonly isMobile: boolean;
}
 
/**
 * Props for StanceAura component (3D effect)
 *
 * @category Component Props
 * @korean 자세오라속성
 */
export interface StanceAuraProps {
  /** Current trigram stance @korean 자세 */
  readonly stance: TrigramStance;
  /** Aura intensity (0-1, typically Ki / 100) @korean 강도 */
  readonly intensity: number;
  /** Whether to animate the aura @korean 애니메이션여부 */
  readonly animated?: boolean;
}