Initial Unity 6 scaffold for Cat Kirby Adventures.

Add Phase A greybox vertical slice: third-person movement, forest path, checkpoints, story triggers, and light ability gate.
This commit is contained in:
ifontosh
2026-09-08 17:09:27 +08:00
commit 1c6c9b2a70
44 changed files with 2553 additions and 0 deletions
@@ -0,0 +1,54 @@
using UnityEngine;
namespace KirbyAdventures
{
public class CheckpointSystem : MonoBehaviour
{
public static CheckpointSystem Instance { get; private set; }
public Vector3 SpawnPosition { get; private set; }
public Quaternion SpawnRotation { get; private set; } = Quaternion.identity;
public string CurrentId { get; private set; } = "start";
void Awake()
{
if (Instance != null && Instance != this)
{
Destroy(gameObject);
return;
}
Instance = this;
}
public static void SetCheckpoint(Vector3 pos, Quaternion rot, string id)
{
if (Instance == null) return;
Instance.SpawnPosition = pos;
Instance.SpawnRotation = rot;
Instance.CurrentId = id;
Debug.Log($"[Checkpoint] Saved: {id}");
}
public static void Respawn(Transform player, CharacterController cc = null)
{
if (Instance == null || player == null) return;
if (cc != null) cc.enabled = false;
player.SetPositionAndRotation(Instance.SpawnPosition, Instance.SpawnRotation);
if (cc != null) cc.enabled = true;
Physics.SyncTransforms();
}
public static void EnsureStart(Vector3 pos, Quaternion rot)
{
if (Instance == null) return;
if (Instance.CurrentId == "start" && Instance.SpawnPosition == Vector3.zero && pos != Vector3.zero
|| Instance.CurrentId == "start")
{
// Always seed start if still default id
}
Instance.SpawnPosition = pos;
Instance.SpawnRotation = rot;
Instance.CurrentId = "start";
}
}
}