mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-09 07:15:55 +00:00
Bullet resource
This commit is contained in:
parent
76221ca7a6
commit
07f6e58ebd
19 changed files with 236 additions and 50 deletions
|
|
@ -1,6 +1,7 @@
|
|||
using Godot;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Cirno.Scripts;
|
||||
using Cirno.Scripts.Components;
|
||||
using Cirno.Scripts.Resources;
|
||||
|
||||
|
|
@ -111,7 +112,7 @@ public partial class Bullet : Area2D
|
|||
private void _on_visible_on_screen_notifier_2d_screen_exited()
|
||||
{
|
||||
//Debug.WriteLine("Destroy bullet out of screen");
|
||||
QueueFree();
|
||||
Destroy();
|
||||
}
|
||||
|
||||
private void _on_body_entered(Node2D body)
|
||||
|
|
@ -119,7 +120,7 @@ public partial class Bullet : Area2D
|
|||
if (body.IsInGroup("Solid"))
|
||||
{
|
||||
//Debug.WriteLine("Collision");
|
||||
QueueFree();
|
||||
Destroy();
|
||||
}
|
||||
//// Do not Collide with body for purpose of destroying bullets
|
||||
// else if (body.IsInGroup("Destroyable"))
|
||||
|
|
@ -134,7 +135,7 @@ public partial class Bullet : Area2D
|
|||
{
|
||||
if (area.IsInGroup("Solid"))
|
||||
{
|
||||
QueueFree();
|
||||
Destroy();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -144,9 +145,21 @@ public partial class Bullet : Area2D
|
|||
|
||||
destructible.Hit(Damage, DamageType);
|
||||
|
||||
QueueFree();
|
||||
Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
if (_bulletInfo?.DestructionParticlesScene != null)
|
||||
{
|
||||
var particle = this.CreateSibling<AutodeleteParticle>(_bulletInfo.DestructionParticlesScene);
|
||||
|
||||
particle.Init();
|
||||
}
|
||||
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
|
||||
public enum BulletOwner
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue