EerieVillage/Assets/Scripts/Mechanics/PlayerController.cs

330 lines
14 KiB
C#
Raw Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Platformer.Gameplay;
using static Platformer.Core.Simulation;
using Platformer.Model;
using Platformer.Core;
using UnityEngine.InputSystem;
namespace Platformer.Mechanics
{
/// <summary>
/// This is the main class used to implement control of the player.
/// It is a superset of the AnimationController class, but is inlined to allow for any kind of customisation.
/// </summary>
public class PlayerController : KinematicObject
{
public AudioClip jumpAudio;
public AudioClip respawnAudio;
public AudioClip ouchAudio;
/// <summary>
/// Attack sound effect. 자동 발동 시 PlayerAttack.Execute가 PlayOneShot으로 재생.
/// BT7-Plan 2026-04-24 — VS 순수형 자동 발동 전환 후에도 audio hook 유지.
/// </summary>
public AudioClip attackAudio;
/// <summary>
/// Max horizontal speed of the player.
/// </summary>
public float maxSpeed = 7;
/// <summary>
/// Initial jump velocity at the start of a jump.
/// </summary>
public float jumpTakeOffSpeed = 7;
/// <summary>
/// Attack hitbox component (자동 GetComponent, 없으면 null — PlayerAttack.Execute에서 null 체크).
/// 공격은 PlayerAttackTicker가 주기적으로 Schedule<PlayerAttack>을 발화하여 실행.
/// </summary>
public AttackHitbox attackHitbox;
public JumpState jumpState = JumpState.Grounded;
private bool stopJump;
BT5-Dev #69: Down + Jump Drop-Through 입력 추가 (PD 명시 채택) PD 명시 (2026-05-08): "발판과 같이 아래가 뚫려있고 이동 가능한 영역이 있는 경우, 아래 방향키 상태로 점프하면 점프 모션과 함께 내려올 수 있도록" 표준 platformer 패턴 (Drop-Through Input): - Player가 발판(Layer 16) 위 + Down 방향키 + Jump 키 동시 입력 - = Layer 16 mask 강제 OFF (DROP_THROUGH_DURATION=0.3초) → 발판 통과 - = velocity.y = 0 (위 점프 X·gravity로 자연 낙하) - = jumpState = PrepareToJump (점프 애니메이션 발동·시각상 점프 모션) 변경 (PlayerController.cs 3영역): 1. 클래스 변수 추가: - float dropThroughTimer (Layer 16 mask 강제 OFF 지속 시간) - const float DROP_THROUGH_DURATION = 0.3f - bool dropThroughJump (본 frame Drop-Through 점프 발동 분기) 2. Update 영역: - Move Input 영역 y < -0.5 (Down) + Jump WasPressed → dropThroughTimer 활성 + dropThroughJump=true - 매 frame dropThroughTimer 감소 (Time.deltaTime) 3. UpdateContactFilterForDropThrough 영역: - isJumpingThrough 조건에 dropThroughTimer > 0 추가 - Drop-Through 활성 시 Layer 16 mask 강제 OFF 4. ComputeVelocity 영역: - jump && IsGrounded 시 dropThroughJump 분기: - dropThroughJump → velocity.y = 0 (위 점프 X) - else → velocity.y = jumpTakeOffSpeed (기존 정상 점프) 효과 (PD 의도 정합): - 일반 점프 (Jump only) = 위로 점프 (그대로) - Drop-Through (Down + Jump) = 발판 통과 + 점프 모션 + 자연 낙하 - 0.3초 후 mask 자동 복원 (다른 발판 위 정상 착지 가능) 후속 의무: - PD Refresh+Play 시각 검증 (발판 위 + Down + Jump → 통과·낙하 + 점프 애니메이션) - 정합 시 BT49~BT65 영구 폐기 + R2 + BT68 + BT69 영역 영구 채택
2026-05-07 15:26:12 +00:00
BT5-Dev #75: 발판 시스템 영구 마무리 — 시행착오 주석 정리·dead code 제거 PD 명시 (2026-05-08): "플레이어 조작 시스템 완성. 시행착오로 불필요하게 생성된 코드·작업물 제거 + 최신 상태로만 깔끔하게" 정리 영역: 1. GameOptimizer.cs (Write 전체 재작성): - 헤더 주석 — BT5-Dev 발판 시스템 영구 영역 명시 + 동작 요약 5단계 - BT34·BT46·BT66·BT67·BT48·BT63·BT68 시행착오 주석 영역 통합 정리 - Debug.Log 영역 통합 1행 ([GameOptimizer] 출력) - IsSmallAirPlatform 헬퍼 영역 보존 (BT48 휴리스틱 사용 중) 2. PlayerController.cs (Edit 부분 정리): - dropThroughTimer·jumpAscentTimer 변수 영역 주석 정리 - OnCollisionEnter2D BT30-Collide 진단 Debug.Log 영역 폐기 (시행착오) - BT69·BT70·BT71·BT72·BT73·BT74 시행착오 주석 영역 통합 정리 - UpdateContactFilterForDropThrough 영역 메서드 docstring 추가 3. KinematicObject.cs (Edit 부분 정리): - BT68 X·Y 분리 영역 주석 정리 영구 채택 영역: - R2 (BT66): AutoForeground GameObject 분리 + PD Foreground = 가림막 시각만 - BT67: AutoForeground transform 동기화 (PD Foreground·Level 영역과 동일) - BT68: KinematicObject X·Y 분리 + GameOptimizer TileGround* 자동 분류 제외 - BT69~BT74: Drop-Through (Down + Jump) Input 패턴 + 가장자리 jitter 차단 플레이어 조작 시스템 완성: - 발판 위 착지·점프 통과·자유 이동 - Down + Jump = Drop-Through (발판 위만) - 전진 점프 시 앞 벽 hit + 위로 점프 보존 - 대각선 벽 통과 X (TileGround* Level 잔존) - 발판 가장자리 jitter 차단 (3점 Raycast + 밀림 강제 Drop-Through)
2026-05-07 15:49:26 +00:00
// Drop-Through (Down + Jump) — 발판 위에서 Down 유지 + 점프 시 발판 통과 + 점프 모션 + 자연 낙하
private float dropThroughTimer = 0f;
private const float DROP_THROUGH_DURATION = 0.3f;
private bool dropThroughJump = false;
BT5-Dev #75: 발판 시스템 영구 마무리 — 시행착오 주석 정리·dead code 제거 PD 명시 (2026-05-08): "플레이어 조작 시스템 완성. 시행착오로 불필요하게 생성된 코드·작업물 제거 + 최신 상태로만 깔끔하게" 정리 영역: 1. GameOptimizer.cs (Write 전체 재작성): - 헤더 주석 — BT5-Dev 발판 시스템 영구 영역 명시 + 동작 요약 5단계 - BT34·BT46·BT66·BT67·BT48·BT63·BT68 시행착오 주석 영역 통합 정리 - Debug.Log 영역 통합 1행 ([GameOptimizer] 출력) - IsSmallAirPlatform 헬퍼 영역 보존 (BT48 휴리스틱 사용 중) 2. PlayerController.cs (Edit 부분 정리): - dropThroughTimer·jumpAscentTimer 변수 영역 주석 정리 - OnCollisionEnter2D BT30-Collide 진단 Debug.Log 영역 폐기 (시행착오) - BT69·BT70·BT71·BT72·BT73·BT74 시행착오 주석 영역 통합 정리 - UpdateContactFilterForDropThrough 영역 메서드 docstring 추가 3. KinematicObject.cs (Edit 부분 정리): - BT68 X·Y 분리 영역 주석 정리 영구 채택 영역: - R2 (BT66): AutoForeground GameObject 분리 + PD Foreground = 가림막 시각만 - BT67: AutoForeground transform 동기화 (PD Foreground·Level 영역과 동일) - BT68: KinematicObject X·Y 분리 + GameOptimizer TileGround* 자동 분류 제외 - BT69~BT74: Drop-Through (Down + Jump) Input 패턴 + 가장자리 jitter 차단 플레이어 조작 시스템 완성: - 발판 위 착지·점프 통과·자유 이동 - Down + Jump = Drop-Through (발판 위만) - 전진 점프 시 앞 벽 hit + 위로 점프 보존 - 대각선 벽 통과 X (TileGround* Level 잔존) - 발판 가장자리 jitter 차단 (3점 Raycast + 밀림 강제 Drop-Through)
2026-05-07 15:49:26 +00:00
// Jump Ascent — 점프 ascending·정점 영역 mask 강제 OFF 보장 (정점 jitter 차단)
private float jumpAscentTimer = 0f;
BT5-Dev #75: 발판 시스템 영구 마무리 — 시행착오 주석 정리·dead code 제거 PD 명시 (2026-05-08): "플레이어 조작 시스템 완성. 시행착오로 불필요하게 생성된 코드·작업물 제거 + 최신 상태로만 깔끔하게" 정리 영역: 1. GameOptimizer.cs (Write 전체 재작성): - 헤더 주석 — BT5-Dev 발판 시스템 영구 영역 명시 + 동작 요약 5단계 - BT34·BT46·BT66·BT67·BT48·BT63·BT68 시행착오 주석 영역 통합 정리 - Debug.Log 영역 통합 1행 ([GameOptimizer] 출력) - IsSmallAirPlatform 헬퍼 영역 보존 (BT48 휴리스틱 사용 중) 2. PlayerController.cs (Edit 부분 정리): - dropThroughTimer·jumpAscentTimer 변수 영역 주석 정리 - OnCollisionEnter2D BT30-Collide 진단 Debug.Log 영역 폐기 (시행착오) - BT69·BT70·BT71·BT72·BT73·BT74 시행착오 주석 영역 통합 정리 - UpdateContactFilterForDropThrough 영역 메서드 docstring 추가 3. KinematicObject.cs (Edit 부분 정리): - BT68 X·Y 분리 영역 주석 정리 영구 채택 영역: - R2 (BT66): AutoForeground GameObject 분리 + PD Foreground = 가림막 시각만 - BT67: AutoForeground transform 동기화 (PD Foreground·Level 영역과 동일) - BT68: KinematicObject X·Y 분리 + GameOptimizer TileGround* 자동 분류 제외 - BT69~BT74: Drop-Through (Down + Jump) Input 패턴 + 가장자리 jitter 차단 플레이어 조작 시스템 완성: - 발판 위 착지·점프 통과·자유 이동 - Down + Jump = Drop-Through (발판 위만) - 전진 점프 시 앞 벽 hit + 위로 점프 보존 - 대각선 벽 통과 X (TileGround* Level 잔존) - 발판 가장자리 jitter 차단 (3점 Raycast + 밀림 강제 Drop-Through)
2026-05-07 15:49:26 +00:00
private const float JUMP_ASCENT_DURATION = 0.4f;
/*internal new*/ public Collider2D collider2d;
/*internal new*/ public AudioSource audioSource;
public Health health;
public bool controlEnabled = true;
bool jump;
Vector2 move;
SpriteRenderer spriteRenderer;
internal Animator animator;
readonly PlatformerModel model = Simulation.GetModel<PlatformerModel>();
private InputAction m_MoveAction;
private InputAction m_JumpAction;
// 현재 facing 방향 (마지막 이동 입력 기반, 정지 시 이전 값 유지).
// BT7-Plan 2026-04-24 — PlayerAttackTicker가 자동 발동 시 참조하므로 public 노출.
Vector2 facing = Vector2.right;
/// <summary>현재 플레이어 facing 방향. PlayerAttackTicker가 Schedule 시점에 참조.</summary>
public Vector2 Facing => facing;
public Bounds Bounds => collider2d.bounds;
/// <summary>
/// 마지막 grounded 위치 — 낙사 시 안전 복귀 영역 (PD 지시 2026-05-07).
/// </summary>
public Vector3 LastGroundedPosition { get; private set; }
void Awake()
{
health = GetComponent<Health>();
audioSource = GetComponent<AudioSource>();
collider2d = GetComponent<Collider2D>();
spriteRenderer = GetComponent<SpriteRenderer>();
if (spriteRenderer == null) spriteRenderer = GetComponentInChildren<SpriteRenderer>();
animator = GetComponent<Animator>();
if (animator == null) animator = GetComponentInChildren<Animator>();
BT5-Dev #75: 발판 시스템 영구 마무리 — 시행착오 주석 정리·dead code 제거 PD 명시 (2026-05-08): "플레이어 조작 시스템 완성. 시행착오로 불필요하게 생성된 코드·작업물 제거 + 최신 상태로만 깔끔하게" 정리 영역: 1. GameOptimizer.cs (Write 전체 재작성): - 헤더 주석 — BT5-Dev 발판 시스템 영구 영역 명시 + 동작 요약 5단계 - BT34·BT46·BT66·BT67·BT48·BT63·BT68 시행착오 주석 영역 통합 정리 - Debug.Log 영역 통합 1행 ([GameOptimizer] 출력) - IsSmallAirPlatform 헬퍼 영역 보존 (BT48 휴리스틱 사용 중) 2. PlayerController.cs (Edit 부분 정리): - dropThroughTimer·jumpAscentTimer 변수 영역 주석 정리 - OnCollisionEnter2D BT30-Collide 진단 Debug.Log 영역 폐기 (시행착오) - BT69·BT70·BT71·BT72·BT73·BT74 시행착오 주석 영역 통합 정리 - UpdateContactFilterForDropThrough 영역 메서드 docstring 추가 3. KinematicObject.cs (Edit 부분 정리): - BT68 X·Y 분리 영역 주석 정리 영구 채택 영역: - R2 (BT66): AutoForeground GameObject 분리 + PD Foreground = 가림막 시각만 - BT67: AutoForeground transform 동기화 (PD Foreground·Level 영역과 동일) - BT68: KinematicObject X·Y 분리 + GameOptimizer TileGround* 자동 분류 제외 - BT69~BT74: Drop-Through (Down + Jump) Input 패턴 + 가장자리 jitter 차단 플레이어 조작 시스템 완성: - 발판 위 착지·점프 통과·자유 이동 - Down + Jump = Drop-Through (발판 위만) - 전진 점프 시 앞 벽 hit + 위로 점프 보존 - 대각선 벽 통과 X (TileGround* Level 잔존) - 발판 가장자리 jitter 차단 (3점 Raycast + 밀림 강제 Drop-Through)
2026-05-07 15:49:26 +00:00
// 동반 컴포넌트 자동 부착 (Inspector 부착 불요)
if (GetComponent<PlayerInvulnerabilityFlash>() == null) gameObject.AddComponent<PlayerInvulnerabilityFlash>();
if (GetComponent<Platformer.UI.ResurrectPromptUI>() == null) gameObject.AddComponent<Platformer.UI.ResurrectPromptUI>();
BT12-MVP-A Phase 2-A: 경험치·레벨업 시스템 코드 + JSON 테이블 PD 직접 지시 2026-05-08 — (b) 채택 + JSON 테이블 영역 관리. 신규 영역 (8 파일): - Assets/Resources/Progression/level_xp_table.json — Lv 1~30 EXP 테이블 (balance-designer SOT) - Assets/Scripts/Progression/LevelXPTableLoader.cs — Resources.Load + JsonUtility 캐시 - Assets/Scripts/Progression/PlayerProgression.cs — Level·EXP 진행도 (BT12-Dev v1 PlayerStats와 직무 분리) - Assets/Scripts/Progression/ExperienceSystem.cs — EXP 발급 정적 게이트웨이 - Assets/Scripts/Progression/SkillCardPlaceholder.cs — placeholder ScriptableObject - Assets/Scripts/Progression/SkillCardPlaceholderPool.cs — 카드 풀·Draw3Random - Assets/Scripts/Progression/LevelUpManager.cs — 레벨업 발화·일시정지·UI placeholder (Phase 2-B 통합) 기존 파일 수정 (2 파일): - EnemyDeath.cs Execute 마지막 영역 ExperienceSystem.OnEnemyKilled 호출 - PlayerController.cs Awake PlayerProgression 자동 부착 회귀 위험: - BT5-Dev 발판/몬스터 영역 영향 X (EnemyDeath 호출 마지막·PlayerController 자동 부착) - BT7-Dev VS 순수형 영향 X (Schedule 영역 변경 X) - BT12-Dev v1 영역 충돌 X (PlayerStats 분리·신규 namespace EerieVillage.Progression) Phase 2-A 영역 검증: - 적 처치 → EXP 누적 → Lv 임계점 → Console [LevelUpManager] 영역 출력 확증 - Phase 2-B 영역 = SkillSelectionUI prefab + 5 placeholder asset + Scene 통합
2026-05-08 08:53:39 +00:00
// BT12-MVP-A 영역 신규 (2026-05-08) — PlayerProgression 자동 부착 (레벨업 영역)
if (GetComponent<EerieVillage.Progression.PlayerProgression>() == null)
gameObject.AddComponent<EerieVillage.Progression.PlayerProgression>();
// Phase 2-D 신규 (2026-05-09) — PlayerSkillInventory 자동 부착 (스킬 인벤토리)
feat(BT12-Dev Phase 2-D): BT12-MVP-A 통합 정정 (placeholder → 정식 ActiveSkillData) + Phase 2-B .meta 보충 C49 Phase 2-D — Sonnet 위임 (코드 Write·검증만·git 본 PM 처리 정합·feedback_pm_sonnet_subagent_unauthorized_push 정합). 수정 6 파일: - LevelUpManager.cs (Phase 2-D 정정·_pool 제거·SkillRuntimeFactory.RandomDraw3·HandleCardConfirmed(ActiveSkillData)·PlayerSkillInventory.AddSkillByCardId) - SkillSelectionUI.cs (Show(List<ActiveSkillData>)·_selected·BindSlot·OnCardSelected ActiveSkillData 전환) - SkillCardSlot.cs (Bind(ActiveSkillData)·DisplayName/Description/Icon PascalCase·rarity 배너 갈색 고정) - PlayerController.cs (PlayerSkillInventory 자동 부착·line 100) - Projectile.cs (Layer Enemy 미등재 fallback — EnemyController 컴포넌트 검사·proxy) - SkillRuntimeFactory.cs (RandomDraw3 메서드·Active 카테고리 무작위 3장) 신규 9 .meta (Phase 2-B Sonnet 자율 push 영역 영역 영역 영역 X·Unity Editor Refresh 후 자동 생성·본 commit 보충): - Skills.meta + Effectors.meta + 7 Effectors/*.cs.meta Layer Enemy 영역 = proxy 개선 신호 (C2-2): - 현 시점 = Projectile.OnTriggerEnter2D 영역 EnemyController 컴포넌트 fallback (proxy) - 근본 해결안 = Layer "Enemy" 정식 등재 (별도 PD 안건·후속) 기능: - 적 처치 → EXP +1 → 즉시 레벨업 → 카드 3장 노출 → 선택 → PlayerSkillInventory 등록 → ActiveSkillRuntime Tick → 1.5s 영역 자동 발사 + 부가 효과 (DoT·Stun·Slow·DebuffStack) 기존 영역 변경 X (BT5-Dev·BT7-Dev·Phase 2-A·2-B·2-C·BT12-MVP-A asset 5장·Scene·SkillCardPlaceholder·SkillCardPlaceholderPool·deprecate 차후) Compile error 0건 (read_console·도메인 리로드 정합) C49 — Phase 2-D Sonnet 위임 + Phase 3 본 PM 직접 (단순 반복 카탈로그 v1) C50 — ~95K (PD 사전 승인 70~95K 영역 상한 정합) C19-2 — Sonnet 자율 git X·본 PM 직접 commit·push (feedback 정합) pm-auditor 사전 감사 = Pass + Minor 1 (Layer fallback proxy 명시·본 commit + 대화로그 영역 정정 적용) 후속: - Phase 2-A·2-B·2-C·2-D 영역 PD Play 검증 (자동 발동·레벨업·카드 선택·등록·Tick) - Layer "Enemy" 정식 등재 (별도 PD 안건·근본 해결안) - Phase 2-E EditMode 테스트 - 다른 카테고리 (B·C·D·E·F) 영역 - BT12-MVP-A asset 5장 deprecate (차기) - Screenshots·_Recovery .gitignore (별도)
2026-05-09 11:57:28 +00:00
if (GetComponent<EerieVillage.Skills.PlayerSkillInventory>() == null)
gameObject.AddComponent<EerieVillage.Skills.PlayerSkillInventory>();
// BT12-Dev 후속 (2026-05-09) — SkillInventoryHUD 자동 부착 (PD 시각화 지시)
if (GetComponent<EerieVillage.MyUI.SkillInventoryHUD>() == null)
gameObject.AddComponent<EerieVillage.MyUI.SkillInventoryHUD>();
BT5-Dev #75: 발판 시스템 영구 마무리 — 시행착오 주석 정리·dead code 제거 PD 명시 (2026-05-08): "플레이어 조작 시스템 완성. 시행착오로 불필요하게 생성된 코드·작업물 제거 + 최신 상태로만 깔끔하게" 정리 영역: 1. GameOptimizer.cs (Write 전체 재작성): - 헤더 주석 — BT5-Dev 발판 시스템 영구 영역 명시 + 동작 요약 5단계 - BT34·BT46·BT66·BT67·BT48·BT63·BT68 시행착오 주석 영역 통합 정리 - Debug.Log 영역 통합 1행 ([GameOptimizer] 출력) - IsSmallAirPlatform 헬퍼 영역 보존 (BT48 휴리스틱 사용 중) 2. PlayerController.cs (Edit 부분 정리): - dropThroughTimer·jumpAscentTimer 변수 영역 주석 정리 - OnCollisionEnter2D BT30-Collide 진단 Debug.Log 영역 폐기 (시행착오) - BT69·BT70·BT71·BT72·BT73·BT74 시행착오 주석 영역 통합 정리 - UpdateContactFilterForDropThrough 영역 메서드 docstring 추가 3. KinematicObject.cs (Edit 부분 정리): - BT68 X·Y 분리 영역 주석 정리 영구 채택 영역: - R2 (BT66): AutoForeground GameObject 분리 + PD Foreground = 가림막 시각만 - BT67: AutoForeground transform 동기화 (PD Foreground·Level 영역과 동일) - BT68: KinematicObject X·Y 분리 + GameOptimizer TileGround* 자동 분류 제외 - BT69~BT74: Drop-Through (Down + Jump) Input 패턴 + 가장자리 jitter 차단 플레이어 조작 시스템 완성: - 발판 위 착지·점프 통과·자유 이동 - Down + Jump = Drop-Through (발판 위만) - 전진 점프 시 앞 벽 hit + 위로 점프 보존 - 대각선 벽 통과 X (TileGround* Level 잔존) - 발판 가장자리 jitter 차단 (3점 Raycast + 밀림 강제 Drop-Through)
2026-05-07 15:49:26 +00:00
// 사망 시 입력 차단 / 부활 시 입력 복원
if (health != null)
{
health.OnDeathEvent += OnHealthDeath;
health.OnResurrectEvent += OnHealthResurrect;
}
if (attackHitbox == null) attackHitbox = GetComponent<AttackHitbox>();
m_MoveAction = InputSystem.actions.FindAction("Player/Move");
m_JumpAction = InputSystem.actions.FindAction("Player/Jump");
m_MoveAction.Enable();
m_JumpAction.Enable();
LastGroundedPosition = transform.position;
}
void OnDestroy()
{
if (health != null)
{
health.OnDeathEvent -= OnHealthDeath;
health.OnResurrectEvent -= OnHealthResurrect;
}
}
void OnHealthDeath()
{
controlEnabled = false;
move = Vector2.zero;
}
void OnHealthResurrect()
{
controlEnabled = true;
}
protected override void Update()
{
if (controlEnabled)
{
BT5-Dev #69: Down + Jump Drop-Through 입력 추가 (PD 명시 채택) PD 명시 (2026-05-08): "발판과 같이 아래가 뚫려있고 이동 가능한 영역이 있는 경우, 아래 방향키 상태로 점프하면 점프 모션과 함께 내려올 수 있도록" 표준 platformer 패턴 (Drop-Through Input): - Player가 발판(Layer 16) 위 + Down 방향키 + Jump 키 동시 입력 - = Layer 16 mask 강제 OFF (DROP_THROUGH_DURATION=0.3초) → 발판 통과 - = velocity.y = 0 (위 점프 X·gravity로 자연 낙하) - = jumpState = PrepareToJump (점프 애니메이션 발동·시각상 점프 모션) 변경 (PlayerController.cs 3영역): 1. 클래스 변수 추가: - float dropThroughTimer (Layer 16 mask 강제 OFF 지속 시간) - const float DROP_THROUGH_DURATION = 0.3f - bool dropThroughJump (본 frame Drop-Through 점프 발동 분기) 2. Update 영역: - Move Input 영역 y < -0.5 (Down) + Jump WasPressed → dropThroughTimer 활성 + dropThroughJump=true - 매 frame dropThroughTimer 감소 (Time.deltaTime) 3. UpdateContactFilterForDropThrough 영역: - isJumpingThrough 조건에 dropThroughTimer > 0 추가 - Drop-Through 활성 시 Layer 16 mask 강제 OFF 4. ComputeVelocity 영역: - jump && IsGrounded 시 dropThroughJump 분기: - dropThroughJump → velocity.y = 0 (위 점프 X) - else → velocity.y = jumpTakeOffSpeed (기존 정상 점프) 효과 (PD 의도 정합): - 일반 점프 (Jump only) = 위로 점프 (그대로) - Drop-Through (Down + Jump) = 발판 통과 + 점프 모션 + 자연 낙하 - 0.3초 후 mask 자동 복원 (다른 발판 위 정상 착지 가능) 후속 의무: - PD Refresh+Play 시각 검증 (발판 위 + Down + Jump → 통과·낙하 + 점프 애니메이션) - 정합 시 BT49~BT65 영구 폐기 + R2 + BT68 + BT69 영역 영구 채택
2026-05-07 15:26:12 +00:00
Vector2 moveInput = m_MoveAction.ReadValue<Vector2>();
move.x = moveInput.x;
if (jumpState == JumpState.Grounded && m_JumpAction.WasPressedThisFrame())
BT5-Dev #69: Down + Jump Drop-Through 입력 추가 (PD 명시 채택) PD 명시 (2026-05-08): "발판과 같이 아래가 뚫려있고 이동 가능한 영역이 있는 경우, 아래 방향키 상태로 점프하면 점프 모션과 함께 내려올 수 있도록" 표준 platformer 패턴 (Drop-Through Input): - Player가 발판(Layer 16) 위 + Down 방향키 + Jump 키 동시 입력 - = Layer 16 mask 강제 OFF (DROP_THROUGH_DURATION=0.3초) → 발판 통과 - = velocity.y = 0 (위 점프 X·gravity로 자연 낙하) - = jumpState = PrepareToJump (점프 애니메이션 발동·시각상 점프 모션) 변경 (PlayerController.cs 3영역): 1. 클래스 변수 추가: - float dropThroughTimer (Layer 16 mask 강제 OFF 지속 시간) - const float DROP_THROUGH_DURATION = 0.3f - bool dropThroughJump (본 frame Drop-Through 점프 발동 분기) 2. Update 영역: - Move Input 영역 y < -0.5 (Down) + Jump WasPressed → dropThroughTimer 활성 + dropThroughJump=true - 매 frame dropThroughTimer 감소 (Time.deltaTime) 3. UpdateContactFilterForDropThrough 영역: - isJumpingThrough 조건에 dropThroughTimer > 0 추가 - Drop-Through 활성 시 Layer 16 mask 강제 OFF 4. ComputeVelocity 영역: - jump && IsGrounded 시 dropThroughJump 분기: - dropThroughJump → velocity.y = 0 (위 점프 X) - else → velocity.y = jumpTakeOffSpeed (기존 정상 점프) 효과 (PD 의도 정합): - 일반 점프 (Jump only) = 위로 점프 (그대로) - Drop-Through (Down + Jump) = 발판 통과 + 점프 모션 + 자연 낙하 - 0.3초 후 mask 자동 복원 (다른 발판 위 정상 착지 가능) 후속 의무: - PD Refresh+Play 시각 검증 (발판 위 + Down + Jump → 통과·낙하 + 점프 애니메이션) - 정합 시 BT49~BT65 영구 폐기 + R2 + BT68 + BT69 영역 영구 채택
2026-05-07 15:26:12 +00:00
{
BT5-Dev #75: 발판 시스템 영구 마무리 — 시행착오 주석 정리·dead code 제거 PD 명시 (2026-05-08): "플레이어 조작 시스템 완성. 시행착오로 불필요하게 생성된 코드·작업물 제거 + 최신 상태로만 깔끔하게" 정리 영역: 1. GameOptimizer.cs (Write 전체 재작성): - 헤더 주석 — BT5-Dev 발판 시스템 영구 영역 명시 + 동작 요약 5단계 - BT34·BT46·BT66·BT67·BT48·BT63·BT68 시행착오 주석 영역 통합 정리 - Debug.Log 영역 통합 1행 ([GameOptimizer] 출력) - IsSmallAirPlatform 헬퍼 영역 보존 (BT48 휴리스틱 사용 중) 2. PlayerController.cs (Edit 부분 정리): - dropThroughTimer·jumpAscentTimer 변수 영역 주석 정리 - OnCollisionEnter2D BT30-Collide 진단 Debug.Log 영역 폐기 (시행착오) - BT69·BT70·BT71·BT72·BT73·BT74 시행착오 주석 영역 통합 정리 - UpdateContactFilterForDropThrough 영역 메서드 docstring 추가 3. KinematicObject.cs (Edit 부분 정리): - BT68 X·Y 분리 영역 주석 정리 영구 채택 영역: - R2 (BT66): AutoForeground GameObject 분리 + PD Foreground = 가림막 시각만 - BT67: AutoForeground transform 동기화 (PD Foreground·Level 영역과 동일) - BT68: KinematicObject X·Y 분리 + GameOptimizer TileGround* 자동 분류 제외 - BT69~BT74: Drop-Through (Down + Jump) Input 패턴 + 가장자리 jitter 차단 플레이어 조작 시스템 완성: - 발판 위 착지·점프 통과·자유 이동 - Down + Jump = Drop-Through (발판 위만) - 전진 점프 시 앞 벽 hit + 위로 점프 보존 - 대각선 벽 통과 X (TileGround* Level 잔존) - 발판 가장자리 jitter 차단 (3점 Raycast + 밀림 강제 Drop-Through)
2026-05-07 15:49:26 +00:00
// Down + Jump 발판 위 = Drop-Through 발동 / 지면 위 = 일반 점프
BT5-Dev #69: Down + Jump Drop-Through 입력 추가 (PD 명시 채택) PD 명시 (2026-05-08): "발판과 같이 아래가 뚫려있고 이동 가능한 영역이 있는 경우, 아래 방향키 상태로 점프하면 점프 모션과 함께 내려올 수 있도록" 표준 platformer 패턴 (Drop-Through Input): - Player가 발판(Layer 16) 위 + Down 방향키 + Jump 키 동시 입력 - = Layer 16 mask 강제 OFF (DROP_THROUGH_DURATION=0.3초) → 발판 통과 - = velocity.y = 0 (위 점프 X·gravity로 자연 낙하) - = jumpState = PrepareToJump (점프 애니메이션 발동·시각상 점프 모션) 변경 (PlayerController.cs 3영역): 1. 클래스 변수 추가: - float dropThroughTimer (Layer 16 mask 강제 OFF 지속 시간) - const float DROP_THROUGH_DURATION = 0.3f - bool dropThroughJump (본 frame Drop-Through 점프 발동 분기) 2. Update 영역: - Move Input 영역 y < -0.5 (Down) + Jump WasPressed → dropThroughTimer 활성 + dropThroughJump=true - 매 frame dropThroughTimer 감소 (Time.deltaTime) 3. UpdateContactFilterForDropThrough 영역: - isJumpingThrough 조건에 dropThroughTimer > 0 추가 - Drop-Through 활성 시 Layer 16 mask 강제 OFF 4. ComputeVelocity 영역: - jump && IsGrounded 시 dropThroughJump 분기: - dropThroughJump → velocity.y = 0 (위 점프 X) - else → velocity.y = jumpTakeOffSpeed (기존 정상 점프) 효과 (PD 의도 정합): - 일반 점프 (Jump only) = 위로 점프 (그대로) - Drop-Through (Down + Jump) = 발판 통과 + 점프 모션 + 자연 낙하 - 0.3초 후 mask 자동 복원 (다른 발판 위 정상 착지 가능) 후속 의무: - PD Refresh+Play 시각 검증 (발판 위 + Down + Jump → 통과·낙하 + 점프 애니메이션) - 정합 시 BT49~BT65 영구 폐기 + R2 + BT68 + BT69 영역 영구 채택
2026-05-07 15:26:12 +00:00
bool downHeld = moveInput.y < -0.5f;
bool onJumpThroughPlatform = false;
if (downHeld && collider2d != null)
{
Vector2 dropFootPos = new Vector2(collider2d.bounds.center.x, collider2d.bounds.min.y + 0.02f);
int jumpThroughMask = 1 << JUMP_THROUGH_LAYER;
RaycastHit2D dropFootHit = Physics2D.Raycast(dropFootPos, Vector2.down, 0.1f, jumpThroughMask);
onJumpThroughPlatform = dropFootHit.collider != null;
}
if (downHeld && onJumpThroughPlatform)
BT5-Dev #69: Down + Jump Drop-Through 입력 추가 (PD 명시 채택) PD 명시 (2026-05-08): "발판과 같이 아래가 뚫려있고 이동 가능한 영역이 있는 경우, 아래 방향키 상태로 점프하면 점프 모션과 함께 내려올 수 있도록" 표준 platformer 패턴 (Drop-Through Input): - Player가 발판(Layer 16) 위 + Down 방향키 + Jump 키 동시 입력 - = Layer 16 mask 강제 OFF (DROP_THROUGH_DURATION=0.3초) → 발판 통과 - = velocity.y = 0 (위 점프 X·gravity로 자연 낙하) - = jumpState = PrepareToJump (점프 애니메이션 발동·시각상 점프 모션) 변경 (PlayerController.cs 3영역): 1. 클래스 변수 추가: - float dropThroughTimer (Layer 16 mask 강제 OFF 지속 시간) - const float DROP_THROUGH_DURATION = 0.3f - bool dropThroughJump (본 frame Drop-Through 점프 발동 분기) 2. Update 영역: - Move Input 영역 y < -0.5 (Down) + Jump WasPressed → dropThroughTimer 활성 + dropThroughJump=true - 매 frame dropThroughTimer 감소 (Time.deltaTime) 3. UpdateContactFilterForDropThrough 영역: - isJumpingThrough 조건에 dropThroughTimer > 0 추가 - Drop-Through 활성 시 Layer 16 mask 강제 OFF 4. ComputeVelocity 영역: - jump && IsGrounded 시 dropThroughJump 분기: - dropThroughJump → velocity.y = 0 (위 점프 X) - else → velocity.y = jumpTakeOffSpeed (기존 정상 점프) 효과 (PD 의도 정합): - 일반 점프 (Jump only) = 위로 점프 (그대로) - Drop-Through (Down + Jump) = 발판 통과 + 점프 모션 + 자연 낙하 - 0.3초 후 mask 자동 복원 (다른 발판 위 정상 착지 가능) 후속 의무: - PD Refresh+Play 시각 검증 (발판 위 + Down + Jump → 통과·낙하 + 점프 애니메이션) - 정합 시 BT49~BT65 영구 폐기 + R2 + BT68 + BT69 영역 영구 채택
2026-05-07 15:26:12 +00:00
{
dropThroughTimer = DROP_THROUGH_DURATION;
dropThroughJump = true;
}
jumpState = JumpState.PrepareToJump;
BT5-Dev #69: Down + Jump Drop-Through 입력 추가 (PD 명시 채택) PD 명시 (2026-05-08): "발판과 같이 아래가 뚫려있고 이동 가능한 영역이 있는 경우, 아래 방향키 상태로 점프하면 점프 모션과 함께 내려올 수 있도록" 표준 platformer 패턴 (Drop-Through Input): - Player가 발판(Layer 16) 위 + Down 방향키 + Jump 키 동시 입력 - = Layer 16 mask 강제 OFF (DROP_THROUGH_DURATION=0.3초) → 발판 통과 - = velocity.y = 0 (위 점프 X·gravity로 자연 낙하) - = jumpState = PrepareToJump (점프 애니메이션 발동·시각상 점프 모션) 변경 (PlayerController.cs 3영역): 1. 클래스 변수 추가: - float dropThroughTimer (Layer 16 mask 강제 OFF 지속 시간) - const float DROP_THROUGH_DURATION = 0.3f - bool dropThroughJump (본 frame Drop-Through 점프 발동 분기) 2. Update 영역: - Move Input 영역 y < -0.5 (Down) + Jump WasPressed → dropThroughTimer 활성 + dropThroughJump=true - 매 frame dropThroughTimer 감소 (Time.deltaTime) 3. UpdateContactFilterForDropThrough 영역: - isJumpingThrough 조건에 dropThroughTimer > 0 추가 - Drop-Through 활성 시 Layer 16 mask 강제 OFF 4. ComputeVelocity 영역: - jump && IsGrounded 시 dropThroughJump 분기: - dropThroughJump → velocity.y = 0 (위 점프 X) - else → velocity.y = jumpTakeOffSpeed (기존 정상 점프) 효과 (PD 의도 정합): - 일반 점프 (Jump only) = 위로 점프 (그대로) - Drop-Through (Down + Jump) = 발판 통과 + 점프 모션 + 자연 낙하 - 0.3초 후 mask 자동 복원 (다른 발판 위 정상 착지 가능) 후속 의무: - PD Refresh+Play 시각 검증 (발판 위 + Down + Jump → 통과·낙하 + 점프 애니메이션) - 정합 시 BT49~BT65 영구 폐기 + R2 + BT68 + BT69 영역 영구 채택
2026-05-07 15:26:12 +00:00
}
else if (m_JumpAction.WasReleasedThisFrame())
{
stopJump = true;
Schedule<PlayerStopJump>().player = this;
}
// 공격은 PlayerAttackTicker가 자동 주기로 Schedule<PlayerAttack>을 발화 (BT7-Plan VS 순수형).
}
else
{
move.x = 0;
}
BT5-Dev #69: Down + Jump Drop-Through 입력 추가 (PD 명시 채택) PD 명시 (2026-05-08): "발판과 같이 아래가 뚫려있고 이동 가능한 영역이 있는 경우, 아래 방향키 상태로 점프하면 점프 모션과 함께 내려올 수 있도록" 표준 platformer 패턴 (Drop-Through Input): - Player가 발판(Layer 16) 위 + Down 방향키 + Jump 키 동시 입력 - = Layer 16 mask 강제 OFF (DROP_THROUGH_DURATION=0.3초) → 발판 통과 - = velocity.y = 0 (위 점프 X·gravity로 자연 낙하) - = jumpState = PrepareToJump (점프 애니메이션 발동·시각상 점프 모션) 변경 (PlayerController.cs 3영역): 1. 클래스 변수 추가: - float dropThroughTimer (Layer 16 mask 강제 OFF 지속 시간) - const float DROP_THROUGH_DURATION = 0.3f - bool dropThroughJump (본 frame Drop-Through 점프 발동 분기) 2. Update 영역: - Move Input 영역 y < -0.5 (Down) + Jump WasPressed → dropThroughTimer 활성 + dropThroughJump=true - 매 frame dropThroughTimer 감소 (Time.deltaTime) 3. UpdateContactFilterForDropThrough 영역: - isJumpingThrough 조건에 dropThroughTimer > 0 추가 - Drop-Through 활성 시 Layer 16 mask 강제 OFF 4. ComputeVelocity 영역: - jump && IsGrounded 시 dropThroughJump 분기: - dropThroughJump → velocity.y = 0 (위 점프 X) - else → velocity.y = jumpTakeOffSpeed (기존 정상 점프) 효과 (PD 의도 정합): - 일반 점프 (Jump only) = 위로 점프 (그대로) - Drop-Through (Down + Jump) = 발판 통과 + 점프 모션 + 자연 낙하 - 0.3초 후 mask 자동 복원 (다른 발판 위 정상 착지 가능) 후속 의무: - PD Refresh+Play 시각 검증 (발판 위 + Down + Jump → 통과·낙하 + 점프 애니메이션) - 정합 시 BT49~BT65 영구 폐기 + R2 + BT68 + BT69 영역 영구 채택
2026-05-07 15:26:12 +00:00
BT5-Dev #75: 발판 시스템 영구 마무리 — 시행착오 주석 정리·dead code 제거 PD 명시 (2026-05-08): "플레이어 조작 시스템 완성. 시행착오로 불필요하게 생성된 코드·작업물 제거 + 최신 상태로만 깔끔하게" 정리 영역: 1. GameOptimizer.cs (Write 전체 재작성): - 헤더 주석 — BT5-Dev 발판 시스템 영구 영역 명시 + 동작 요약 5단계 - BT34·BT46·BT66·BT67·BT48·BT63·BT68 시행착오 주석 영역 통합 정리 - Debug.Log 영역 통합 1행 ([GameOptimizer] 출력) - IsSmallAirPlatform 헬퍼 영역 보존 (BT48 휴리스틱 사용 중) 2. PlayerController.cs (Edit 부분 정리): - dropThroughTimer·jumpAscentTimer 변수 영역 주석 정리 - OnCollisionEnter2D BT30-Collide 진단 Debug.Log 영역 폐기 (시행착오) - BT69·BT70·BT71·BT72·BT73·BT74 시행착오 주석 영역 통합 정리 - UpdateContactFilterForDropThrough 영역 메서드 docstring 추가 3. KinematicObject.cs (Edit 부분 정리): - BT68 X·Y 분리 영역 주석 정리 영구 채택 영역: - R2 (BT66): AutoForeground GameObject 분리 + PD Foreground = 가림막 시각만 - BT67: AutoForeground transform 동기화 (PD Foreground·Level 영역과 동일) - BT68: KinematicObject X·Y 분리 + GameOptimizer TileGround* 자동 분류 제외 - BT69~BT74: Drop-Through (Down + Jump) Input 패턴 + 가장자리 jitter 차단 플레이어 조작 시스템 완성: - 발판 위 착지·점프 통과·자유 이동 - Down + Jump = Drop-Through (발판 위만) - 전진 점프 시 앞 벽 hit + 위로 점프 보존 - 대각선 벽 통과 X (TileGround* Level 잔존) - 발판 가장자리 jitter 차단 (3점 Raycast + 밀림 강제 Drop-Through)
2026-05-07 15:49:26 +00:00
// Drop-Through·Jump Ascent Timer 감소 (mask 강제 OFF 지속 시간)
BT5-Dev #69: Down + Jump Drop-Through 입력 추가 (PD 명시 채택) PD 명시 (2026-05-08): "발판과 같이 아래가 뚫려있고 이동 가능한 영역이 있는 경우, 아래 방향키 상태로 점프하면 점프 모션과 함께 내려올 수 있도록" 표준 platformer 패턴 (Drop-Through Input): - Player가 발판(Layer 16) 위 + Down 방향키 + Jump 키 동시 입력 - = Layer 16 mask 강제 OFF (DROP_THROUGH_DURATION=0.3초) → 발판 통과 - = velocity.y = 0 (위 점프 X·gravity로 자연 낙하) - = jumpState = PrepareToJump (점프 애니메이션 발동·시각상 점프 모션) 변경 (PlayerController.cs 3영역): 1. 클래스 변수 추가: - float dropThroughTimer (Layer 16 mask 강제 OFF 지속 시간) - const float DROP_THROUGH_DURATION = 0.3f - bool dropThroughJump (본 frame Drop-Through 점프 발동 분기) 2. Update 영역: - Move Input 영역 y < -0.5 (Down) + Jump WasPressed → dropThroughTimer 활성 + dropThroughJump=true - 매 frame dropThroughTimer 감소 (Time.deltaTime) 3. UpdateContactFilterForDropThrough 영역: - isJumpingThrough 조건에 dropThroughTimer > 0 추가 - Drop-Through 활성 시 Layer 16 mask 강제 OFF 4. ComputeVelocity 영역: - jump && IsGrounded 시 dropThroughJump 분기: - dropThroughJump → velocity.y = 0 (위 점프 X) - else → velocity.y = jumpTakeOffSpeed (기존 정상 점프) 효과 (PD 의도 정합): - 일반 점프 (Jump only) = 위로 점프 (그대로) - Drop-Through (Down + Jump) = 발판 통과 + 점프 모션 + 자연 낙하 - 0.3초 후 mask 자동 복원 (다른 발판 위 정상 착지 가능) 후속 의무: - PD Refresh+Play 시각 검증 (발판 위 + Down + Jump → 통과·낙하 + 점프 애니메이션) - 정합 시 BT49~BT65 영구 폐기 + R2 + BT68 + BT69 영역 영구 채택
2026-05-07 15:26:12 +00:00
if (dropThroughTimer > 0f) dropThroughTimer -= Time.deltaTime;
if (jumpAscentTimer > 0f) jumpAscentTimer -= Time.deltaTime;
UpdateJumpState();
base.Update();
BT5-Dev #75: 발판 시스템 영구 마무리 — 시행착오 주석 정리·dead code 제거 PD 명시 (2026-05-08): "플레이어 조작 시스템 완성. 시행착오로 불필요하게 생성된 코드·작업물 제거 + 최신 상태로만 깔끔하게" 정리 영역: 1. GameOptimizer.cs (Write 전체 재작성): - 헤더 주석 — BT5-Dev 발판 시스템 영구 영역 명시 + 동작 요약 5단계 - BT34·BT46·BT66·BT67·BT48·BT63·BT68 시행착오 주석 영역 통합 정리 - Debug.Log 영역 통합 1행 ([GameOptimizer] 출력) - IsSmallAirPlatform 헬퍼 영역 보존 (BT48 휴리스틱 사용 중) 2. PlayerController.cs (Edit 부분 정리): - dropThroughTimer·jumpAscentTimer 변수 영역 주석 정리 - OnCollisionEnter2D BT30-Collide 진단 Debug.Log 영역 폐기 (시행착오) - BT69·BT70·BT71·BT72·BT73·BT74 시행착오 주석 영역 통합 정리 - UpdateContactFilterForDropThrough 영역 메서드 docstring 추가 3. KinematicObject.cs (Edit 부분 정리): - BT68 X·Y 분리 영역 주석 정리 영구 채택 영역: - R2 (BT66): AutoForeground GameObject 분리 + PD Foreground = 가림막 시각만 - BT67: AutoForeground transform 동기화 (PD Foreground·Level 영역과 동일) - BT68: KinematicObject X·Y 분리 + GameOptimizer TileGround* 자동 분류 제외 - BT69~BT74: Drop-Through (Down + Jump) Input 패턴 + 가장자리 jitter 차단 플레이어 조작 시스템 완성: - 발판 위 착지·점프 통과·자유 이동 - Down + Jump = Drop-Through (발판 위만) - 전진 점프 시 앞 벽 hit + 위로 점프 보존 - 대각선 벽 통과 X (TileGround* Level 잔존) - 발판 가장자리 jitter 차단 (3점 Raycast + 밀림 강제 Drop-Through)
2026-05-07 15:49:26 +00:00
// 낙사 시 복귀할 안전 위치 추적
if (IsGrounded) LastGroundedPosition = transform.position;
}
BT5-Dev #75: 발판 시스템 영구 마무리 — 시행착오 주석 정리·dead code 제거 PD 명시 (2026-05-08): "플레이어 조작 시스템 완성. 시행착오로 불필요하게 생성된 코드·작업물 제거 + 최신 상태로만 깔끔하게" 정리 영역: 1. GameOptimizer.cs (Write 전체 재작성): - 헤더 주석 — BT5-Dev 발판 시스템 영구 영역 명시 + 동작 요약 5단계 - BT34·BT46·BT66·BT67·BT48·BT63·BT68 시행착오 주석 영역 통합 정리 - Debug.Log 영역 통합 1행 ([GameOptimizer] 출력) - IsSmallAirPlatform 헬퍼 영역 보존 (BT48 휴리스틱 사용 중) 2. PlayerController.cs (Edit 부분 정리): - dropThroughTimer·jumpAscentTimer 변수 영역 주석 정리 - OnCollisionEnter2D BT30-Collide 진단 Debug.Log 영역 폐기 (시행착오) - BT69·BT70·BT71·BT72·BT73·BT74 시행착오 주석 영역 통합 정리 - UpdateContactFilterForDropThrough 영역 메서드 docstring 추가 3. KinematicObject.cs (Edit 부분 정리): - BT68 X·Y 분리 영역 주석 정리 영구 채택 영역: - R2 (BT66): AutoForeground GameObject 분리 + PD Foreground = 가림막 시각만 - BT67: AutoForeground transform 동기화 (PD Foreground·Level 영역과 동일) - BT68: KinematicObject X·Y 분리 + GameOptimizer TileGround* 자동 분류 제외 - BT69~BT74: Drop-Through (Down + Jump) Input 패턴 + 가장자리 jitter 차단 플레이어 조작 시스템 완성: - 발판 위 착지·점프 통과·자유 이동 - Down + Jump = Drop-Through (발판 위만) - 전진 점프 시 앞 벽 hit + 위로 점프 보존 - 대각선 벽 통과 X (TileGround* Level 잔존) - 발판 가장자리 jitter 차단 (3점 Raycast + 밀림 강제 Drop-Through)
2026-05-07 15:49:26 +00:00
// Drop-Through Layer (Foreground·AutoForeground GameObject Layer 16).
// KinematicObject body.Cast의 contactFilter는 Start() 시점 캐싱되므로 Drop-Through는 SetLayerMask 동적 갱신으로 처리.
const int JUMP_THROUGH_LAYER = 16;
void UpdateJumpState()
{
jump = false;
switch (jumpState)
{
case JumpState.PrepareToJump:
jumpState = JumpState.Jumping;
jump = true;
stopJump = false;
BT5-Dev #75: 발판 시스템 영구 마무리 — 시행착오 주석 정리·dead code 제거 PD 명시 (2026-05-08): "플레이어 조작 시스템 완성. 시행착오로 불필요하게 생성된 코드·작업물 제거 + 최신 상태로만 깔끔하게" 정리 영역: 1. GameOptimizer.cs (Write 전체 재작성): - 헤더 주석 — BT5-Dev 발판 시스템 영구 영역 명시 + 동작 요약 5단계 - BT34·BT46·BT66·BT67·BT48·BT63·BT68 시행착오 주석 영역 통합 정리 - Debug.Log 영역 통합 1행 ([GameOptimizer] 출력) - IsSmallAirPlatform 헬퍼 영역 보존 (BT48 휴리스틱 사용 중) 2. PlayerController.cs (Edit 부분 정리): - dropThroughTimer·jumpAscentTimer 변수 영역 주석 정리 - OnCollisionEnter2D BT30-Collide 진단 Debug.Log 영역 폐기 (시행착오) - BT69·BT70·BT71·BT72·BT73·BT74 시행착오 주석 영역 통합 정리 - UpdateContactFilterForDropThrough 영역 메서드 docstring 추가 3. KinematicObject.cs (Edit 부분 정리): - BT68 X·Y 분리 영역 주석 정리 영구 채택 영역: - R2 (BT66): AutoForeground GameObject 분리 + PD Foreground = 가림막 시각만 - BT67: AutoForeground transform 동기화 (PD Foreground·Level 영역과 동일) - BT68: KinematicObject X·Y 분리 + GameOptimizer TileGround* 자동 분류 제외 - BT69~BT74: Drop-Through (Down + Jump) Input 패턴 + 가장자리 jitter 차단 플레이어 조작 시스템 완성: - 발판 위 착지·점프 통과·자유 이동 - Down + Jump = Drop-Through (발판 위만) - 전진 점프 시 앞 벽 hit + 위로 점프 보존 - 대각선 벽 통과 X (TileGround* Level 잔존) - 발판 가장자리 jitter 차단 (3점 Raycast + 밀림 강제 Drop-Through)
2026-05-07 15:49:26 +00:00
// 일반 점프만 ascending 통과 보장 Timer 활성 (Drop-Through는 dropThroughTimer로 처리)
if (!dropThroughJump) jumpAscentTimer = JUMP_ASCENT_DURATION;
BT5-Dev #75: 발판 시스템 영구 마무리 — 시행착오 주석 정리·dead code 제거 PD 명시 (2026-05-08): "플레이어 조작 시스템 완성. 시행착오로 불필요하게 생성된 코드·작업물 제거 + 최신 상태로만 깔끔하게" 정리 영역: 1. GameOptimizer.cs (Write 전체 재작성): - 헤더 주석 — BT5-Dev 발판 시스템 영구 영역 명시 + 동작 요약 5단계 - BT34·BT46·BT66·BT67·BT48·BT63·BT68 시행착오 주석 영역 통합 정리 - Debug.Log 영역 통합 1행 ([GameOptimizer] 출력) - IsSmallAirPlatform 헬퍼 영역 보존 (BT48 휴리스틱 사용 중) 2. PlayerController.cs (Edit 부분 정리): - dropThroughTimer·jumpAscentTimer 변수 영역 주석 정리 - OnCollisionEnter2D BT30-Collide 진단 Debug.Log 영역 폐기 (시행착오) - BT69·BT70·BT71·BT72·BT73·BT74 시행착오 주석 영역 통합 정리 - UpdateContactFilterForDropThrough 영역 메서드 docstring 추가 3. KinematicObject.cs (Edit 부분 정리): - BT68 X·Y 분리 영역 주석 정리 영구 채택 영역: - R2 (BT66): AutoForeground GameObject 분리 + PD Foreground = 가림막 시각만 - BT67: AutoForeground transform 동기화 (PD Foreground·Level 영역과 동일) - BT68: KinematicObject X·Y 분리 + GameOptimizer TileGround* 자동 분류 제외 - BT69~BT74: Drop-Through (Down + Jump) Input 패턴 + 가장자리 jitter 차단 플레이어 조작 시스템 완성: - 발판 위 착지·점프 통과·자유 이동 - Down + Jump = Drop-Through (발판 위만) - 전진 점프 시 앞 벽 hit + 위로 점프 보존 - 대각선 벽 통과 X (TileGround* Level 잔존) - 발판 가장자리 jitter 차단 (3점 Raycast + 밀림 강제 Drop-Through)
2026-05-07 15:49:26 +00:00
// PrepareToJump frame 즉시 mask OFF — 다음 frame ComputeVelocity의 velocity.y 적용 직전 발판 충돌 차단
{
int baseMaskJump = Physics2D.GetLayerCollisionMask(gameObject.layer);
contactFilter.SetLayerMask(baseMaskJump & ~(1 << JUMP_THROUGH_LAYER));
contactFilter.useLayerMask = true;
}
break;
case JumpState.Jumping:
if (!IsGrounded)
{
Schedule<PlayerJumped>().player = this;
jumpState = JumpState.InFlight;
}
break;
case JumpState.InFlight:
if (IsGrounded)
{
Schedule<PlayerLanded>().player = this;
jumpState = JumpState.Landed;
}
break;
case JumpState.Landed:
jumpState = JumpState.Grounded;
break;
}
UpdateContactFilterForDropThrough();
}
BT5-Dev #75: 발판 시스템 영구 마무리 — 시행착오 주석 정리·dead code 제거 PD 명시 (2026-05-08): "플레이어 조작 시스템 완성. 시행착오로 불필요하게 생성된 코드·작업물 제거 + 최신 상태로만 깔끔하게" 정리 영역: 1. GameOptimizer.cs (Write 전체 재작성): - 헤더 주석 — BT5-Dev 발판 시스템 영구 영역 명시 + 동작 요약 5단계 - BT34·BT46·BT66·BT67·BT48·BT63·BT68 시행착오 주석 영역 통합 정리 - Debug.Log 영역 통합 1행 ([GameOptimizer] 출력) - IsSmallAirPlatform 헬퍼 영역 보존 (BT48 휴리스틱 사용 중) 2. PlayerController.cs (Edit 부분 정리): - dropThroughTimer·jumpAscentTimer 변수 영역 주석 정리 - OnCollisionEnter2D BT30-Collide 진단 Debug.Log 영역 폐기 (시행착오) - BT69·BT70·BT71·BT72·BT73·BT74 시행착오 주석 영역 통합 정리 - UpdateContactFilterForDropThrough 영역 메서드 docstring 추가 3. KinematicObject.cs (Edit 부분 정리): - BT68 X·Y 분리 영역 주석 정리 영구 채택 영역: - R2 (BT66): AutoForeground GameObject 분리 + PD Foreground = 가림막 시각만 - BT67: AutoForeground transform 동기화 (PD Foreground·Level 영역과 동일) - BT68: KinematicObject X·Y 분리 + GameOptimizer TileGround* 자동 분류 제외 - BT69~BT74: Drop-Through (Down + Jump) Input 패턴 + 가장자리 jitter 차단 플레이어 조작 시스템 완성: - 발판 위 착지·점프 통과·자유 이동 - Down + Jump = Drop-Through (발판 위만) - 전진 점프 시 앞 벽 hit + 위로 점프 보존 - 대각선 벽 통과 X (TileGround* Level 잔존) - 발판 가장자리 jitter 차단 (3점 Raycast + 밀림 강제 Drop-Through)
2026-05-07 15:49:26 +00:00
/// <summary>
/// Drop-Through 패턴: ascending·정점·Drop-Through Timer 활성 시 Layer 16 mask OFF (통과).
/// 그 외 = footHit 3점 Raycast (Layer 16) — 발판 가장자리 안정 검출.
/// 점프·낙하 중 정점 영역 + 수평 입력 + 발판 가장자리 일시 검출 = 밀림 상태 → 강제 Drop-Through 발동.
/// </summary>
void UpdateContactFilterForDropThrough()
{
int baseMask = Physics2D.GetLayerCollisionMask(gameObject.layer);
bool isJumpingThrough = jumpState == JumpState.Jumping
BT5-Dev #69: Down + Jump Drop-Through 입력 추가 (PD 명시 채택) PD 명시 (2026-05-08): "발판과 같이 아래가 뚫려있고 이동 가능한 영역이 있는 경우, 아래 방향키 상태로 점프하면 점프 모션과 함께 내려올 수 있도록" 표준 platformer 패턴 (Drop-Through Input): - Player가 발판(Layer 16) 위 + Down 방향키 + Jump 키 동시 입력 - = Layer 16 mask 강제 OFF (DROP_THROUGH_DURATION=0.3초) → 발판 통과 - = velocity.y = 0 (위 점프 X·gravity로 자연 낙하) - = jumpState = PrepareToJump (점프 애니메이션 발동·시각상 점프 모션) 변경 (PlayerController.cs 3영역): 1. 클래스 변수 추가: - float dropThroughTimer (Layer 16 mask 강제 OFF 지속 시간) - const float DROP_THROUGH_DURATION = 0.3f - bool dropThroughJump (본 frame Drop-Through 점프 발동 분기) 2. Update 영역: - Move Input 영역 y < -0.5 (Down) + Jump WasPressed → dropThroughTimer 활성 + dropThroughJump=true - 매 frame dropThroughTimer 감소 (Time.deltaTime) 3. UpdateContactFilterForDropThrough 영역: - isJumpingThrough 조건에 dropThroughTimer > 0 추가 - Drop-Through 활성 시 Layer 16 mask 강제 OFF 4. ComputeVelocity 영역: - jump && IsGrounded 시 dropThroughJump 분기: - dropThroughJump → velocity.y = 0 (위 점프 X) - else → velocity.y = jumpTakeOffSpeed (기존 정상 점프) 효과 (PD 의도 정합): - 일반 점프 (Jump only) = 위로 점프 (그대로) - Drop-Through (Down + Jump) = 발판 통과 + 점프 모션 + 자연 낙하 - 0.3초 후 mask 자동 복원 (다른 발판 위 정상 착지 가능) 후속 의무: - PD Refresh+Play 시각 검증 (발판 위 + Down + Jump → 통과·낙하 + 점프 애니메이션) - 정합 시 BT49~BT65 영구 폐기 + R2 + BT68 + BT69 영역 영구 채택
2026-05-07 15:26:12 +00:00
|| (jumpState == JumpState.InFlight && velocity.y > 0.01f)
|| dropThroughTimer > 0f
|| jumpAscentTimer > 0f;
bool standingOnPlatform = false;
if (collider2d != null && !isJumpingThrough)
{
BT5-Dev #75: 발판 시스템 영구 마무리 — 시행착오 주석 정리·dead code 제거 PD 명시 (2026-05-08): "플레이어 조작 시스템 완성. 시행착오로 불필요하게 생성된 코드·작업물 제거 + 최신 상태로만 깔끔하게" 정리 영역: 1. GameOptimizer.cs (Write 전체 재작성): - 헤더 주석 — BT5-Dev 발판 시스템 영구 영역 명시 + 동작 요약 5단계 - BT34·BT46·BT66·BT67·BT48·BT63·BT68 시행착오 주석 영역 통합 정리 - Debug.Log 영역 통합 1행 ([GameOptimizer] 출력) - IsSmallAirPlatform 헬퍼 영역 보존 (BT48 휴리스틱 사용 중) 2. PlayerController.cs (Edit 부분 정리): - dropThroughTimer·jumpAscentTimer 변수 영역 주석 정리 - OnCollisionEnter2D BT30-Collide 진단 Debug.Log 영역 폐기 (시행착오) - BT69·BT70·BT71·BT72·BT73·BT74 시행착오 주석 영역 통합 정리 - UpdateContactFilterForDropThrough 영역 메서드 docstring 추가 3. KinematicObject.cs (Edit 부분 정리): - BT68 X·Y 분리 영역 주석 정리 영구 채택 영역: - R2 (BT66): AutoForeground GameObject 분리 + PD Foreground = 가림막 시각만 - BT67: AutoForeground transform 동기화 (PD Foreground·Level 영역과 동일) - BT68: KinematicObject X·Y 분리 + GameOptimizer TileGround* 자동 분류 제외 - BT69~BT74: Drop-Through (Down + Jump) Input 패턴 + 가장자리 jitter 차단 플레이어 조작 시스템 완성: - 발판 위 착지·점프 통과·자유 이동 - Down + Jump = Drop-Through (발판 위만) - 전진 점프 시 앞 벽 hit + 위로 점프 보존 - 대각선 벽 통과 X (TileGround* Level 잔존) - 발판 가장자리 jitter 차단 (3점 Raycast + 밀림 강제 Drop-Through)
2026-05-07 15:49:26 +00:00
// footHit Raycast 3점 (좌·중·우) — 가장자리 jitter 차단
float footY = collider2d.bounds.min.y + 0.02f;
float boundsLeft = collider2d.bounds.min.x + 0.02f;
float boundsCenter = collider2d.bounds.center.x;
float boundsRight = collider2d.bounds.max.x - 0.02f;
int jumpThroughMask = 1 << JUMP_THROUGH_LAYER;
RaycastHit2D footHitC = Physics2D.Raycast(new Vector2(boundsCenter, footY), Vector2.down, 0.1f, jumpThroughMask);
RaycastHit2D footHitL = Physics2D.Raycast(new Vector2(boundsLeft, footY), Vector2.down, 0.1f, jumpThroughMask);
RaycastHit2D footHitR = Physics2D.Raycast(new Vector2(boundsRight, footY), Vector2.down, 0.1f, jumpThroughMask);
standingOnPlatform = footHitC.collider != null || footHitL.collider != null || footHitR.collider != null;
BT5-Dev #75: 발판 시스템 영구 마무리 — 시행착오 주석 정리·dead code 제거 PD 명시 (2026-05-08): "플레이어 조작 시스템 완성. 시행착오로 불필요하게 생성된 코드·작업물 제거 + 최신 상태로만 깔끔하게" 정리 영역: 1. GameOptimizer.cs (Write 전체 재작성): - 헤더 주석 — BT5-Dev 발판 시스템 영구 영역 명시 + 동작 요약 5단계 - BT34·BT46·BT66·BT67·BT48·BT63·BT68 시행착오 주석 영역 통합 정리 - Debug.Log 영역 통합 1행 ([GameOptimizer] 출력) - IsSmallAirPlatform 헬퍼 영역 보존 (BT48 휴리스틱 사용 중) 2. PlayerController.cs (Edit 부분 정리): - dropThroughTimer·jumpAscentTimer 변수 영역 주석 정리 - OnCollisionEnter2D BT30-Collide 진단 Debug.Log 영역 폐기 (시행착오) - BT69·BT70·BT71·BT72·BT73·BT74 시행착오 주석 영역 통합 정리 - UpdateContactFilterForDropThrough 영역 메서드 docstring 추가 3. KinematicObject.cs (Edit 부분 정리): - BT68 X·Y 분리 영역 주석 정리 영구 채택 영역: - R2 (BT66): AutoForeground GameObject 분리 + PD Foreground = 가림막 시각만 - BT67: AutoForeground transform 동기화 (PD Foreground·Level 영역과 동일) - BT68: KinematicObject X·Y 분리 + GameOptimizer TileGround* 자동 분류 제외 - BT69~BT74: Drop-Through (Down + Jump) Input 패턴 + 가장자리 jitter 차단 플레이어 조작 시스템 완성: - 발판 위 착지·점프 통과·자유 이동 - Down + Jump = Drop-Through (발판 위만) - 전진 점프 시 앞 벽 hit + 위로 점프 보존 - 대각선 벽 통과 X (TileGround* Level 잔존) - 발판 가장자리 jitter 차단 (3점 Raycast + 밀림 강제 Drop-Through)
2026-05-07 15:49:26 +00:00
// 밀림 상태 강제 Drop-Through (점프·낙하 중 정점 + 수평 입력 + 발판 가장자리 일시 검출)
bool inAir = jumpState == JumpState.Jumping || jumpState == JumpState.InFlight;
bool nearApex = velocity.y > -1.5f;
bool horizontalIntent = Mathf.Abs(move.x) > 0.1f;
if (standingOnPlatform && inAir && nearApex && horizontalIntent)
{
dropThroughTimer = DROP_THROUGH_DURATION;
standingOnPlatform = false;
}
}
int mask = standingOnPlatform ? baseMask : (baseMask & ~(1 << JUMP_THROUGH_LAYER));
contactFilter.SetLayerMask(mask);
contactFilter.useLayerMask = true;
}
protected override void ComputeVelocity()
{
if (jump && IsGrounded)
{
BT5-Dev #75: 발판 시스템 영구 마무리 — 시행착오 주석 정리·dead code 제거 PD 명시 (2026-05-08): "플레이어 조작 시스템 완성. 시행착오로 불필요하게 생성된 코드·작업물 제거 + 최신 상태로만 깔끔하게" 정리 영역: 1. GameOptimizer.cs (Write 전체 재작성): - 헤더 주석 — BT5-Dev 발판 시스템 영구 영역 명시 + 동작 요약 5단계 - BT34·BT46·BT66·BT67·BT48·BT63·BT68 시행착오 주석 영역 통합 정리 - Debug.Log 영역 통합 1행 ([GameOptimizer] 출력) - IsSmallAirPlatform 헬퍼 영역 보존 (BT48 휴리스틱 사용 중) 2. PlayerController.cs (Edit 부분 정리): - dropThroughTimer·jumpAscentTimer 변수 영역 주석 정리 - OnCollisionEnter2D BT30-Collide 진단 Debug.Log 영역 폐기 (시행착오) - BT69·BT70·BT71·BT72·BT73·BT74 시행착오 주석 영역 통합 정리 - UpdateContactFilterForDropThrough 영역 메서드 docstring 추가 3. KinematicObject.cs (Edit 부분 정리): - BT68 X·Y 분리 영역 주석 정리 영구 채택 영역: - R2 (BT66): AutoForeground GameObject 분리 + PD Foreground = 가림막 시각만 - BT67: AutoForeground transform 동기화 (PD Foreground·Level 영역과 동일) - BT68: KinematicObject X·Y 분리 + GameOptimizer TileGround* 자동 분류 제외 - BT69~BT74: Drop-Through (Down + Jump) Input 패턴 + 가장자리 jitter 차단 플레이어 조작 시스템 완성: - 발판 위 착지·점프 통과·자유 이동 - Down + Jump = Drop-Through (발판 위만) - 전진 점프 시 앞 벽 hit + 위로 점프 보존 - 대각선 벽 통과 X (TileGround* Level 잔존) - 발판 가장자리 jitter 차단 (3점 Raycast + 밀림 강제 Drop-Through)
2026-05-07 15:49:26 +00:00
// Drop-Through 점프: 위로 점프 X (음수 velocity.y로 즉시 낙하 시작 + 점프 애니메이션만 유지)
BT5-Dev #69: Down + Jump Drop-Through 입력 추가 (PD 명시 채택) PD 명시 (2026-05-08): "발판과 같이 아래가 뚫려있고 이동 가능한 영역이 있는 경우, 아래 방향키 상태로 점프하면 점프 모션과 함께 내려올 수 있도록" 표준 platformer 패턴 (Drop-Through Input): - Player가 발판(Layer 16) 위 + Down 방향키 + Jump 키 동시 입력 - = Layer 16 mask 강제 OFF (DROP_THROUGH_DURATION=0.3초) → 발판 통과 - = velocity.y = 0 (위 점프 X·gravity로 자연 낙하) - = jumpState = PrepareToJump (점프 애니메이션 발동·시각상 점프 모션) 변경 (PlayerController.cs 3영역): 1. 클래스 변수 추가: - float dropThroughTimer (Layer 16 mask 강제 OFF 지속 시간) - const float DROP_THROUGH_DURATION = 0.3f - bool dropThroughJump (본 frame Drop-Through 점프 발동 분기) 2. Update 영역: - Move Input 영역 y < -0.5 (Down) + Jump WasPressed → dropThroughTimer 활성 + dropThroughJump=true - 매 frame dropThroughTimer 감소 (Time.deltaTime) 3. UpdateContactFilterForDropThrough 영역: - isJumpingThrough 조건에 dropThroughTimer > 0 추가 - Drop-Through 활성 시 Layer 16 mask 강제 OFF 4. ComputeVelocity 영역: - jump && IsGrounded 시 dropThroughJump 분기: - dropThroughJump → velocity.y = 0 (위 점프 X) - else → velocity.y = jumpTakeOffSpeed (기존 정상 점프) 효과 (PD 의도 정합): - 일반 점프 (Jump only) = 위로 점프 (그대로) - Drop-Through (Down + Jump) = 발판 통과 + 점프 모션 + 자연 낙하 - 0.3초 후 mask 자동 복원 (다른 발판 위 정상 착지 가능) 후속 의무: - PD Refresh+Play 시각 검증 (발판 위 + Down + Jump → 통과·낙하 + 점프 애니메이션) - 정합 시 BT49~BT65 영구 폐기 + R2 + BT68 + BT69 영역 영구 채택
2026-05-07 15:26:12 +00:00
if (dropThroughJump)
{
BT5-Dev #75: 발판 시스템 영구 마무리 — 시행착오 주석 정리·dead code 제거 PD 명시 (2026-05-08): "플레이어 조작 시스템 완성. 시행착오로 불필요하게 생성된 코드·작업물 제거 + 최신 상태로만 깔끔하게" 정리 영역: 1. GameOptimizer.cs (Write 전체 재작성): - 헤더 주석 — BT5-Dev 발판 시스템 영구 영역 명시 + 동작 요약 5단계 - BT34·BT46·BT66·BT67·BT48·BT63·BT68 시행착오 주석 영역 통합 정리 - Debug.Log 영역 통합 1행 ([GameOptimizer] 출력) - IsSmallAirPlatform 헬퍼 영역 보존 (BT48 휴리스틱 사용 중) 2. PlayerController.cs (Edit 부분 정리): - dropThroughTimer·jumpAscentTimer 변수 영역 주석 정리 - OnCollisionEnter2D BT30-Collide 진단 Debug.Log 영역 폐기 (시행착오) - BT69·BT70·BT71·BT72·BT73·BT74 시행착오 주석 영역 통합 정리 - UpdateContactFilterForDropThrough 영역 메서드 docstring 추가 3. KinematicObject.cs (Edit 부분 정리): - BT68 X·Y 분리 영역 주석 정리 영구 채택 영역: - R2 (BT66): AutoForeground GameObject 분리 + PD Foreground = 가림막 시각만 - BT67: AutoForeground transform 동기화 (PD Foreground·Level 영역과 동일) - BT68: KinematicObject X·Y 분리 + GameOptimizer TileGround* 자동 분류 제외 - BT69~BT74: Drop-Through (Down + Jump) Input 패턴 + 가장자리 jitter 차단 플레이어 조작 시스템 완성: - 발판 위 착지·점프 통과·자유 이동 - Down + Jump = Drop-Through (발판 위만) - 전진 점프 시 앞 벽 hit + 위로 점프 보존 - 대각선 벽 통과 X (TileGround* Level 잔존) - 발판 가장자리 jitter 차단 (3점 Raycast + 밀림 강제 Drop-Through)
2026-05-07 15:49:26 +00:00
velocity.y = -0.5f;
BT5-Dev #69: Down + Jump Drop-Through 입력 추가 (PD 명시 채택) PD 명시 (2026-05-08): "발판과 같이 아래가 뚫려있고 이동 가능한 영역이 있는 경우, 아래 방향키 상태로 점프하면 점프 모션과 함께 내려올 수 있도록" 표준 platformer 패턴 (Drop-Through Input): - Player가 발판(Layer 16) 위 + Down 방향키 + Jump 키 동시 입력 - = Layer 16 mask 강제 OFF (DROP_THROUGH_DURATION=0.3초) → 발판 통과 - = velocity.y = 0 (위 점프 X·gravity로 자연 낙하) - = jumpState = PrepareToJump (점프 애니메이션 발동·시각상 점프 모션) 변경 (PlayerController.cs 3영역): 1. 클래스 변수 추가: - float dropThroughTimer (Layer 16 mask 강제 OFF 지속 시간) - const float DROP_THROUGH_DURATION = 0.3f - bool dropThroughJump (본 frame Drop-Through 점프 발동 분기) 2. Update 영역: - Move Input 영역 y < -0.5 (Down) + Jump WasPressed → dropThroughTimer 활성 + dropThroughJump=true - 매 frame dropThroughTimer 감소 (Time.deltaTime) 3. UpdateContactFilterForDropThrough 영역: - isJumpingThrough 조건에 dropThroughTimer > 0 추가 - Drop-Through 활성 시 Layer 16 mask 강제 OFF 4. ComputeVelocity 영역: - jump && IsGrounded 시 dropThroughJump 분기: - dropThroughJump → velocity.y = 0 (위 점프 X) - else → velocity.y = jumpTakeOffSpeed (기존 정상 점프) 효과 (PD 의도 정합): - 일반 점프 (Jump only) = 위로 점프 (그대로) - Drop-Through (Down + Jump) = 발판 통과 + 점프 모션 + 자연 낙하 - 0.3초 후 mask 자동 복원 (다른 발판 위 정상 착지 가능) 후속 의무: - PD Refresh+Play 시각 검증 (발판 위 + Down + Jump → 통과·낙하 + 점프 애니메이션) - 정합 시 BT49~BT65 영구 폐기 + R2 + BT68 + BT69 영역 영구 채택
2026-05-07 15:26:12 +00:00
dropThroughJump = false;
}
else
{
velocity.y = jumpTakeOffSpeed * model.jumpModifier;
}
jump = false;
}
else if (stopJump)
{
stopJump = false;
if (velocity.y > 0)
{
velocity.y = velocity.y * model.jumpDeceleration;
}
}
if (move.x > 0.01f)
{
spriteRenderer.flipX = true;
facing = Vector2.right;
}
else if (move.x < -0.01f)
{
spriteRenderer.flipX = false;
facing = Vector2.left;
}
animator.SetBool("grounded", IsGrounded);
animator.SetFloat("velocityX", Mathf.Abs(velocity.x) / maxSpeed);
targetVelocity = move * maxSpeed;
}
public enum JumpState
{
Grounded,
PrepareToJump,
Jumping,
InFlight,
Landed
}
}
}