spell refactor part 2

This commit is contained in:
2026-01-22 14:54:35 +01:00
parent 1beff44ada
commit a7f91bcd67
30 changed files with 589 additions and 931 deletions

View File

@@ -21,26 +21,24 @@ namespace Beyond
private IEnumerator CastRoutine(MagicAttacks caster, Transform target)
{
// 1. Rotation (Only Push and Flame used rotation in your old script)
if (type != DurationType.Shield)
{
yield return caster.RotateTowardsTargetRoutine(target, rotationDuration);
}
// 2. Pre-cast Delay
if (preCastDelay > 0) yield return new WaitForSeconds(preCastDelay);
// ... (Rotation and Pre-Cast Delay logic) ...
// 3. Instantiate attached to player
// 3. Instantiate
GameObject instance = Instantiate(effectPrefab, caster.transform);
// Reset local position/rotation to ensure it aligns with player
instance.transform.localPosition = Vector3.zero;
instance.transform.localRotation = Quaternion.identity;
// Register Events (for Barks)
caster.RegisterSpellDamageEvents(instance, this);
// 4. Initialize Specific Logic
if (type == DurationType.Shield)
{
var shieldCtrl = instance.GetComponent<ShieldEffectController>();
if (shieldCtrl) shieldCtrl.InitializeEffect();
// --- TOGGLE FLAG ON ---
caster.IsShieldActive = true;
}
else if (type == DurationType.Flamethrower)
{
@@ -69,6 +67,9 @@ namespace Beyond
{
var shieldCtrl = instance.GetComponent<ShieldEffectController>();
if (shieldCtrl) shieldCtrl.DisableEffect();
// --- TOGGLE FLAG OFF ---
caster.IsShieldActive = false;
}
// 7. Post Delay