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 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
/**
 * 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 { PlayerArchetype, TrigramStance } from "./common";
import type { FacialExpression, FacialDamageState } from "./facial";
 
/**
 * Balance state representing player stability in combat.
 * Drives visual indicators and affects combat effectiveness.
 * 
 * @public
 * @category Combat States
 * @korean 균형상태
 */
export type BalanceState = "READY" | "SHAKEN" | "VULNERABLE" | "HELPLESS";
 
/**
 * Player animation states for 3D model pose and movement.
 * 
 * @public
 * @category Animation
 * @korean 애니메이션상태
 */
export type PlayerAnimation =
  | "idle"
  | "attack"
  | "defend"
  | "hit"
  | "stance_change"
  | "technique_execute"
  | "walk"
  | "block"
  | "counter"
  | "death";
 
/**
 * 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.
 * 
 * @public
 * @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;
 
  /**
   * 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)
   * Optional since not all game modes track blood loss
   * @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 (affects scaling and detail)
   * @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 (optional, auto-calculated if not provided)
   * @korean 얼굴표정
   */
  readonly facialExpression?: FacialExpression;
 
  /**
   * Facial damage state (optional, defaults to no damage)
   * @korean 얼굴손상
   */
  readonly facialDamage?: FacialDamageState;
 
  /**
   * Whether to enable facial expressions (opt-in, default: false)
   * @korean 표정사용
   */
  readonly enableFacialExpressions?: boolean;
 
  /**
   * Whether to enable eye tracking (opt-in, default: false)
   * @korean 눈추적사용
   */
  readonly enableEyeTracking?: boolean;
 
  /**
   * Opponent position for eye tracking (optional)
   * @korean 상대위치
   */
  readonly opponentPosition?: [number, number, number];
}
 
/**
 * Props for PlayerStateIndicators component (Html overlay)
 * 
 * @public
 * @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)
 * 
 * @public
 * @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;
}