mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 09:35:34 +00:00
36 lines
No EOL
871 B
C#
36 lines
No EOL
871 B
C#
using Cirno.Scripts.Components.FSM.Player;
|
|
using Godot;
|
|
|
|
namespace Cirno.Scripts.Actors;
|
|
|
|
public partial class Ice : Area2D
|
|
{
|
|
public double Life { get; set; } = 2f;
|
|
//public float FreezeRange { get; private set; } = 16f;
|
|
|
|
public FreezeModule FreezeModule { get; set; }
|
|
|
|
public override void _PhysicsProcess(double delta)
|
|
{
|
|
Life -= delta;
|
|
|
|
if (Life <= 0)
|
|
{
|
|
QueueFree();
|
|
}
|
|
|
|
}
|
|
|
|
private void OnAreaEntered(Area2D area)
|
|
{
|
|
if (area is not Bullet bullet) return;
|
|
if (bullet.IsFrozen) return;
|
|
if (bullet.BulletOwner is BulletOwner.Player) return;
|
|
if (!bullet.BulletInfo.Freezable) return;
|
|
|
|
bullet.Freeze();
|
|
var ice = bullet.CreateSibling<Ice>(FreezeModule.IceScene);
|
|
ice.Life = Life;
|
|
ice.FreezeModule = FreezeModule;
|
|
}
|
|
} |