EerieVillage/Assets/Scripts/Mechanics/MonsterRandomizer.cs

28 lines
1.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using UnityEngine;
namespace Platformer.Mechanics
{
/// <summary>
/// 몬스터 종류 랜덤 — 6 AnimatorOverrideController random select.
/// PD 지시 (2026-05-11): 몬스터 종류 랜덤 변경.
/// 6종 (M001~M006) Idle Clip override·Animator runtimeAnimatorController random.
/// </summary>
public class MonsterRandomizer : MonoBehaviour
{
[Tooltip("이전 호환 — 24 sprite (6종 × 4 frame). Override Controller 신규 영역 후속 폐기 가능.")]
public Sprite[] idleFrames;
[Tooltip("6 AnimatorOverrideController (M001~M006).")]
public AnimatorOverrideController[] overrideControllers;
void Awake()
{
if (overrideControllers == null || overrideControllers.Length == 0) return;
var anim = GetComponent<Animator>();
if (anim == null) return;
int idx = Random.Range(0, overrideControllers.Length);
anim.runtimeAnimatorController = overrideControllers[idx];
}
}
}