mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-07 22:35:55 +00:00
Bullet freeze
This commit is contained in:
parent
57ff504628
commit
34a07342ac
31 changed files with 255 additions and 8 deletions
36
Scripts/Actors/Ice.cs
Normal file
36
Scripts/Actors/Ice.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
1
Scripts/Actors/Ice.cs.uid
Normal file
1
Scripts/Actors/Ice.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://csw0c6gjcmx34
|
||||
Loading…
Add table
Add a link
Reference in a new issue