Quick Start
Start with a tiny working version
Boss fights often feel unfair not because the numbers are too high, but because the rule change is unclear. A new summon pattern begins, the arena becomes unsafe, the boss speeds up, or a second form appears, yet the player cannot tell what actually changed.
Build it in small code pieces
1. 値を用意する
Inspectorで変更できる値と表示先を置きます。
[SerializeField] private TextMeshProUGUI statusText;
[SerializeField] private float bossHpPercent = 1f;
[SerializeField] private float phaseIndex = 2f;
[SerializeField] private float warningSeconds = 3f;2. 状態を変える
ボタンを押した時に、1つだけ状態を進めます。
public void NextStep()
{
step = (step + 1) % 3;
var label = step == 0 ? "通常攻撃" : step == 1 ? "移行予告" : "大技開始";
if (statusText != null)
{
statusText.text = $"{label}\nbossHpPercent={bossHpPercent:0.##}\nphaseIndex={phaseIndex:0.##}\nwarningSeconds={warningSeconds:0.##}";
}3. 画面に表示する
変わった結果を画面に出して確認します。
if (statusText != null)
{
statusText.text = $"{label}\nbossHpPercent={bossHpPercent:0.##}\nphaseIndex={phaseIndex:0.##}\nwarningSeconds={warningSeconds:0.##}";
}
Debug.Log($"ボスのフェーズ移行: {label}");Complete script
using UnityEngine;
using TMPro;
public class BossPhaseTutorial : MonoBehaviour
{
[SerializeField] private TextMeshProUGUI statusText;
[SerializeField] private float bossHpPercent = 1f;
[SerializeField] private float phaseIndex = 2f;
[SerializeField] private float warningSeconds = 3f;
private int step;
public void NextStep()
{
step = (step + 1) % 3;
var label = step == 0 ? "通常攻撃" : step == 1 ? "移行予告" : "大技開始";
if (statusText != null)
{
statusText.text = $"{label}\nbossHpPercent={bossHpPercent:0.##}\nphaseIndex={phaseIndex:0.##}\nwarningSeconds={warningSeconds:0.##}";
}
Debug.Log($"ボスのフェーズ移行: {label}");
}
}Inspector
Summary
What to take away
A practical guide to making boss phase changes readable so players understand what changed, where danger moved, and how to respond.
The page is designed to help you move from reading to a small practical decision. Use the checklist above before jumping into the next related article.
