filesystem rework
This commit is contained in:
parent
64323290cc
commit
2905db3dce
174 changed files with 93 additions and 353 deletions
9
scripts/projectiles/IProjectile.cs
Normal file
9
scripts/projectiles/IProjectile.cs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
namespace Newlon.Components;
|
||||
|
||||
//
|
||||
// Base interface for entities
|
||||
//
|
||||
public interface IProjectile
|
||||
{
|
||||
public int Line { get; set; }
|
||||
}
|
||||
1
scripts/projectiles/IProjectile.cs.uid
Normal file
1
scripts/projectiles/IProjectile.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://blbiq5r0w17hf
|
||||
47
scripts/projectiles/LinearProjectile.cs
Normal file
47
scripts/projectiles/LinearProjectile.cs
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
using Godot;
|
||||
using Newlon.Components.Level;
|
||||
using Newlon.Systems.Effects;
|
||||
|
||||
namespace Newlon.Components;
|
||||
|
||||
//
|
||||
// Projectile that travels from left to right
|
||||
//
|
||||
|
||||
public partial class LinearProjectile : Area2D, IProjectile
|
||||
{
|
||||
[Export(hintString: "suffix:tile/sec")]
|
||||
private float _speed;
|
||||
[Export]
|
||||
private int _damage;
|
||||
[Export]
|
||||
private Effect _impactEffect;
|
||||
[Export]
|
||||
private PackedScene particles;
|
||||
private int _line;
|
||||
private bool used = false;
|
||||
public int Line { get => _line; set { _line = value; } }
|
||||
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
Translate(Transform.X * _speed * (float)delta * FieldParams.TileWidth);
|
||||
}
|
||||
|
||||
public void OnAreaEntered(Area2D area)
|
||||
{
|
||||
if (used == true) return;
|
||||
var entity = area.GetParent<Entity>();
|
||||
if (entity != null)
|
||||
{
|
||||
entity.TakeDamage(_damage,this);
|
||||
used = true;
|
||||
if (_impactEffect != null)
|
||||
entity.GiveEffect(_impactEffect);
|
||||
|
||||
PoolContainer.Instance.SpawnParticles(particles, GlobalPosition, GlobalRotation);
|
||||
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
}
|
||||
1
scripts/projectiles/LinearProjectile.cs.uid
Normal file
1
scripts/projectiles/LinearProjectile.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dxlwvwy3hj56x
|
||||
Loading…
Add table
Add a link
Reference in a new issue