53 lines
1.5 KiB
C#
53 lines
1.5 KiB
C#
using System.Collections;
|
|
using Core;
|
|
using UnityEngine;
|
|
|
|
namespace Minigames.FortFight.Projectiles
|
|
{
|
|
/// <summary>
|
|
/// Ceiling Fan projectile - drops straight down when ability is activated.
|
|
/// Player taps screen mid-flight to activate drop.
|
|
/// </summary>
|
|
public class CeilingFanProjectile : ProjectileBase
|
|
{
|
|
[Header("Ceiling Fan Specific")]
|
|
[Tooltip("Speed of downward drop")]
|
|
[SerializeField] private float dropSpeed = 20f;
|
|
|
|
[Tooltip("Delay before dropping")]
|
|
[SerializeField] private float dropDelay = 0.2f;
|
|
|
|
public override void ActivateAbility()
|
|
{
|
|
base.ActivateAbility();
|
|
|
|
if (AbilityActivated)
|
|
{
|
|
Logging.Debug("[CeilingFanProjectile] Ability activated - dropping straight down");
|
|
StartCoroutine(DropCoroutine());
|
|
}
|
|
}
|
|
|
|
private IEnumerator DropCoroutine()
|
|
{
|
|
// Stop all velocity
|
|
if (rb2D != null)
|
|
{
|
|
rb2D.linearVelocity = Vector2.zero;
|
|
rb2D.angularVelocity = 0f;
|
|
}
|
|
|
|
// Wait brief moment
|
|
yield return new WaitForSeconds(dropDelay);
|
|
|
|
// Drop straight down
|
|
if (rb2D != null)
|
|
{
|
|
rb2D.linearVelocity = Vector2.down * dropSpeed;
|
|
Logging.Debug($"[CeilingFanProjectile] Dropping with velocity: {rb2D.linearVelocity}");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|