Quick Start
Start with a tiny working version
One of the easiest ways to make a boss fight feel unfair is to signal that a phase changed without clearly explaining what changed. A new move set, a wider arena threat, summoned enemies, a relocated weak point, or a harsher resource check can all be good design.
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
Learn how to communicate boss phase changes, danger spikes, and new combat rules clearly without making transitions feel unfair or confusing.
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.
