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,73 @@
using UnityEngine;
using UnityEngine.InputSystem;
namespace KirbyAdventures
{
public class LightAbility : MonoBehaviour
{
public float Range = 18f;
public float Cooldown = 0.75f;
public Transform Origin;
public LayerMask HitMask = ~0;
float _nextReadyTime;
LineRenderer _line;
float _flashUntil;
void Awake()
{
_line = gameObject.AddComponent<LineRenderer>();
_line.positionCount = 2;
_line.startWidth = 0.08f;
_line.endWidth = 0.02f;
_line.material = new Material(Shader.Find("Sprites/Default"));
_line.startColor = new Color(1f, 0.95f, 0.6f, 1f);
_line.endColor = new Color(1f, 0.85f, 0.2f, 0.2f);
_line.enabled = false;
}
void Update()
{
if (GameFlow.Instance != null && (GameFlow.Instance.IsPaused || GameFlow.Instance.HasWon))
return;
if (_line.enabled && Time.time > _flashUntil)
_line.enabled = false;
bool unlocked = GameFlow.Instance == null || GameFlow.Instance.LightAbilityUnlocked;
if (!unlocked) return;
if (Time.time < _nextReadyTime) return;
var mouse = Mouse.current;
var kb = Keyboard.current;
bool fire = (mouse != null && mouse.leftButton.wasPressedThisFrame) ||
(kb != null && kb.eKey.wasPressedThisFrame);
if (fire)
Fire();
}
void Fire()
{
_nextReadyTime = Time.time + Cooldown;
Transform origin = Origin != null ? Origin : transform;
Vector3 start = origin.position + Vector3.up * 1.0f;
Vector3 dir = origin.forward;
if (Camera.main != null)
dir = Camera.main.transform.forward;
Vector3 end = start + dir * Range;
if (Physics.Raycast(start, dir, out RaycastHit hit, Range, HitMask, QueryTriggerInteraction.Collide))
{
end = hit.point;
var reactive = hit.collider.GetComponentInParent<ILightReactive>();
reactive?.OnHitByLight(hit.point, dir);
}
_line.SetPosition(0, start);
_line.SetPosition(1, end);
_line.enabled = true;
_flashUntil = Time.time + 0.12f;
}
}
}