From dd6ab3f8f10946c791cbd8edea99e7433ae3c4a7 Mon Sep 17 00:00:00 2001 From: swrring Date: Sun, 10 May 2026 17:40:06 +0900 Subject: [PATCH] =?UTF-8?q?feat(BT12-Dev):=20MonsterRandomizer=206?= =?UTF-8?q?=EC=A2=85=20sprite=20+=20WallMask=20Layer=2016=20(Layer=200=20L?= =?UTF-8?q?evel=20Tilemap=20=EC=98=81=EC=97=AD=20=EC=98=81=EC=97=AD=20?= =?UTF-8?q?=EA=B1=B0=EB=A6=AC=20X=20=EC=A0=95=EC=A0=95)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Prefabs/Enemy.prefab | 20 +++++++++++ Assets/Scripts/Mechanics/MonsterRandomizer.cs | 33 +++++++++++++++++++ Assets/Scripts/Skills/Effectors/Projectile.cs | 7 ++-- 3 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 Assets/Scripts/Mechanics/MonsterRandomizer.cs diff --git a/Assets/Prefabs/Enemy.prefab b/Assets/Prefabs/Enemy.prefab index 9a64ff2..9499df2 100644 --- a/Assets/Prefabs/Enemy.prefab +++ b/Assets/Prefabs/Enemy.prefab @@ -17,6 +17,7 @@ GameObject: - component: {fileID: 772289407653213039} - component: {fileID: 5843668731025413174} - component: {fileID: 7700000000000000002} + - component: {fileID: 3839436596391012912} m_Layer: 14 m_Name: Enemy m_TagString: Untagged @@ -348,3 +349,22 @@ MonoBehaviour: invulnerableDuration: 0.5 resurrectInvulnerableDuration: 2 canResurrect: 0 +--- !u!114 &3839436596391012912 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1661912868639658944} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f74e42a58e48af646a73723847df5633, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::Platformer.Mechanics.MonsterRandomizer + idleSprites: + - {fileID: -7548370174848201806, guid: f7b7e5d5d35e8ea4a9574fc970089486, type: 3} + - {fileID: 4852648563935847630, guid: f8f1bd54f70dc914f9ff6999cff72846, type: 3} + - {fileID: -480068022978346209, guid: 2cd59e341ddcef747b2fdeed0e184687, type: 3} + - {fileID: 1142325901465378314, guid: 601020362ae2a214298ee67b288426c6, type: 3} + - {fileID: 3001420397446177360, guid: f2ccd91debeaa624bb282fbaa4d0153b, type: 3} + - {fileID: 5433026174052882790, guid: 115d57f5258ccb74f86354a2cd28045d, type: 3} diff --git a/Assets/Scripts/Mechanics/MonsterRandomizer.cs b/Assets/Scripts/Mechanics/MonsterRandomizer.cs new file mode 100644 index 0000000..3a4ebb5 --- /dev/null +++ b/Assets/Scripts/Mechanics/MonsterRandomizer.cs @@ -0,0 +1,33 @@ +using UnityEngine; + +namespace Platformer.Mechanics +{ + /// + /// 몬스터 종류 랜덤 영역. Awake 영역 6 종 (M001~M006) 영역 영역 idle sprite 영역 random 적용. + /// PD 지시 (2026-05-10): "몬스터 종류 다양하게 반영". + /// Animator 영역 영역 — sprite 자동 영역 영역 영역 영역 — Animator 영역 영역 (death animation 영역 영역 영역 영역 후속 영역). + /// + public class MonsterRandomizer : MonoBehaviour + { + [Tooltip("M001~M006 idle sprite 영역 (Inspector 영역 영역 영역 영역·Awake 영역 1 영역 random 영역)")] + public Sprite[] idleSprites; + + void Awake() + { + if (idleSprites == null || idleSprites.Length == 0) + { + idleSprites = Resources.LoadAll("Monsters"); + if (idleSprites == null || idleSprites.Length == 0) return; + } + + var sr = GetComponent(); + if (sr == null) return; + + var anim = GetComponent(); + if (anim != null) anim.enabled = false; // sprite 자동 영역 영역 + + var pick = idleSprites[Random.Range(0, idleSprites.Length)]; + if (pick != null) sr.sprite = pick; + } + } +} diff --git a/Assets/Scripts/Skills/Effectors/Projectile.cs b/Assets/Scripts/Skills/Effectors/Projectile.cs index 92d4e2a..8df92d8 100644 --- a/Assets/Scripts/Skills/Effectors/Projectile.cs +++ b/Assets/Scripts/Skills/Effectors/Projectile.cs @@ -59,10 +59,9 @@ namespace EerieVillage.Skills.Effectors Invoke(nameof(SelfDestruct), _lifetime); } - // BT12-Dev 2026-05-10 (PD #2 fix) — Wall Layer Mask (Layer 0 Default·Ground + Layer 16 Foreground·발판) - // Tilemap = Static collider·Projectile = Trigger·둘 다 Rigidbody2D 부재 → OnTriggerEnter2D 발화 X 영역 영역. - // → Update 영역 Physics2D.OverlapPoint 영역 Wall Layer 영역 영역 영역 SelfDestruct (영역 영역 영역 영역). - protected static readonly int WallLayerMask = (1 << 0) | (1 << 16); + // BT12-Dev 2026-05-10 — Wall Layer Mask. Layer 0 (Default) 영역 Level Tilemap (지면 영역) + Player 영역 영역 영역 → 영역 영역 영역. + // Layer 16 (Foreground·발판) 영역만 Wall 영역 영역. + protected static readonly int WallLayerMask = (1 << 16); protected virtual void Update() {