Files
beyond/Assets/Scripts/Characters/Skills/SilentPeekSpell.cs
2026-01-19 14:25:38 +01:00

64 lines
2.2 KiB
C#

using System.Collections;
using UnityEngine;
namespace Beyond
{
[CreateAssetMenu(menuName = "Magic/Spells/Silent Peek")]
public class SilentPeekSpell : SpellDefinition
{
[Header("Timing")]
[Tooltip("Time to wait before toggling (Matches old 'Start Time')")]
public float startDelay = 0.85f;
// 1. Logic: Angel Eye makes this spell cost 0 Faith
public override float GetFaithCost(Player player)
{
if (player.CurrentTrinketStats.effectAngelEye)
{
return 0f;
}
return base.GetFaithCost(player);
}
public override void Cast(MagicAttacks caster, Transform target)
{
caster.StartCoroutine(CastRoutine(caster));
}
private IEnumerator CastRoutine(MagicAttacks caster)
{
// 2. Logic: Wait for the animation to reach the point (Start Time)
if (startDelay > 0) yield return new WaitForSeconds(startDelay);
if (SilentPeekController.instance != null)
{
if (SilentPeekController.instance.IsActive())
{
// Turn Off
SilentPeekController.instance.SetActive(false);
}
else
{
// Turn On
// A. Get the Item from the Caster (Requires the helper method added above)
bItem spellItem = caster.GetEquippedSpellItem();
// B. Handle Zora's Focus (Effect Breeze) logic
// (Placeholder: Your original code noted this was for future implementation)
if (Player.Instance.CurrentTrinketStats.effectBreeze)
{
// Example: Increase radius or duration here in the future
}
// C. Activate Controller
SilentPeekController.instance.SetActive(true, spellItem);
}
}
else
{
Debug.LogWarning("SilentPeekSpell: SilentPeekController Instance is null.");
}
}
}
}