Moved scripts to namespaces
This commit is contained in:
parent
fd7060e5c5
commit
de2c6261b0
51 changed files with 128 additions and 29 deletions
|
|
@ -1,6 +1,8 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
namespace Newlon.Components;
|
||||
|
||||
public partial class FlashComponent : CanvasGroup
|
||||
{
|
||||
[Export] private float _flashDuration = 0.1f;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
namespace Newlon.Components;
|
||||
|
||||
//
|
||||
// Base interface for entities
|
||||
//
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
namespace Newlon.Components;
|
||||
|
||||
//
|
||||
// Base interface for entities
|
||||
//
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
namespace Newlon.Components;
|
||||
|
||||
public partial class LevelGUIElements : Control
|
||||
{
|
||||
public static LevelGUIElements Instance;
|
||||
|
|
|
|||
33
scripts/components/LinearProjectile.cs
Normal file
33
scripts/components/LinearProjectile.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
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;
|
||||
private int _line;
|
||||
public int Line { get => _line; set { _line = value; } }
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
Translate(Vector2.Right * _speed * (float)delta * Utility.TileWidth);
|
||||
}
|
||||
|
||||
public void OnAreaEntered(Area2D area)
|
||||
{
|
||||
var entity = area.GetParent<IEntity>();
|
||||
if (entity != null && entity.Line == _line)
|
||||
{
|
||||
entity.TakeDamage(_damage);
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
namespace Newlon.Components.GUI;
|
||||
|
||||
public partial class FastForwardButton : Button
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
using Godot;
|
||||
using System;
|
||||
using Newlon.Components.Plants;
|
||||
using Newlon.Components.Level;
|
||||
|
||||
namespace Newlon.Components.GUI;
|
||||
|
||||
public partial class ShovelButton : TextureButton
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
using Godot;
|
||||
using System;
|
||||
using Newlon.Components.Level;
|
||||
|
||||
namespace Newlon.Components.GUI;
|
||||
|
||||
public partial class SunCounter : Label
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
namespace Newlon.Components.GUI;
|
||||
|
||||
public partial class VeilResizer : TextureProgressBar
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
using Godot;
|
||||
using System;
|
||||
using Newlon.Components.GUI.Seedpackets;
|
||||
|
||||
namespace Newlon.Components.GUI;
|
||||
|
||||
public partial class GridLoader : GridContainer
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
using Godot;
|
||||
using Newlon.Components.Level;
|
||||
|
||||
namespace Newlon.Components.GUI;
|
||||
|
||||
public partial class LevelRunButton : Button
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
namespace Newlon.Components.GUI.Seedpackets;
|
||||
|
||||
public class ChoosableHandler : SeedpacketHandler, ISeedpacketPress
|
||||
{
|
||||
public ChoosableHandler(Seedpacket owner) : base(owner)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using Godot;
|
||||
using Newlon.Components.Level;
|
||||
|
||||
namespace Newlon.Components.GUI.Seedpackets;
|
||||
|
||||
public class HotbarHandler : SeedpacketHandler, ISeedpacketPress, ISeedpacketProcess, ISeedpacketUnfocus
|
||||
{
|
||||
public HotbarHandler(Seedpacket owner) : base(owner)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
using System;
|
||||
using Godot;
|
||||
using Newlon.Components.Level;
|
||||
|
||||
namespace Newlon.Components.GUI.Seedpackets;
|
||||
|
||||
public class HotbarPregameHandler : SeedpacketHandler, ISeedpacketPress
|
||||
{
|
||||
public HotbarPregameHandler(Seedpacket owner) : base(owner)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
namespace Newlon.Components.GUI.Seedpackets;
|
||||
|
||||
public interface ISeedpacketPress
|
||||
{
|
||||
public void Pressed();
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
namespace Newlon.Components.GUI.Seedpackets;
|
||||
|
||||
public interface ISeedpacketProcess
|
||||
{
|
||||
public void Process();
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
namespace Newlon.Components.GUI.Seedpackets;
|
||||
|
||||
public interface ISeedpacketUnfocus
|
||||
{
|
||||
public void OnUnfocused();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
namespace Newlon.Components.GUI.Seedpackets;
|
||||
|
||||
public partial class Seedpacket : TextureButton
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
namespace Newlon.Components.GUI.Seedpackets;
|
||||
|
||||
public class SeedpacketHandler
|
||||
{
|
||||
protected Seedpacket _owner;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
using Godot;
|
||||
using Newlon.Components.GUI.Seedpackets;
|
||||
using Newlon.Components.Plants;
|
||||
|
||||
namespace Newlon.Components.Level;
|
||||
|
||||
public partial class PlantField : Node2D
|
||||
{
|
||||
|
|
@ -64,7 +68,7 @@ public partial class PlantField : Node2D
|
|||
|
||||
if (canPlace)
|
||||
_plantSetter.GlobalPosition = expected_pos;
|
||||
_plantSetter.Texture = _resource == null ? null : _resource.Preview;
|
||||
_plantSetter.Texture = _resource?.Preview;
|
||||
}
|
||||
|
||||
public override void _UnhandledInput(InputEvent @event)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
using Godot;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Newlon.Components.Level;
|
||||
|
||||
//
|
||||
// PoolContainer contains nodes that contain different elemnts that generate during runtime
|
||||
// Is not pool in traditional sense, but named like that to prevent repetition
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using Godot;
|
||||
//using Godot.Collections;
|
||||
|
||||
namespace Newlon.Components.Level;
|
||||
|
||||
public partial class RuntimeLevelData : Node
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
namespace Newlon.Components.Level;
|
||||
|
||||
public partial class SunSpawner : Node
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
using Godot;
|
||||
using System;
|
||||
using Newlon.Components.Zombies;
|
||||
|
||||
namespace Newlon.Components.Plants;
|
||||
|
||||
public partial class AreaAttack : Area2D
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
using Godot;
|
||||
using Newlon.Components.Zombies;
|
||||
|
||||
namespace Newlon.Components.Plants;
|
||||
|
||||
public partial class ExplosionComponent : Area2D
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
using Godot;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Newlon.Components.Plants;
|
||||
|
||||
public partial class Eyesight : Area2D
|
||||
{
|
||||
private bool _enemyDetected;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
namespace Newlon.Components.Plants;
|
||||
|
||||
public partial class PlantEyesightLimiter : CollisionShape2D
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
using Godot;
|
||||
using System;
|
||||
using Newlon.Components.Level;
|
||||
|
||||
namespace Newlon.Components.Plants;
|
||||
|
||||
public partial class PlantSunSpawner : Node2D
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
using Godot;
|
||||
using System;
|
||||
using Newlon.Components.Level;
|
||||
|
||||
namespace Newlon.Components.Plants;
|
||||
|
||||
//
|
||||
// Data that plant stores during runtime
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
using Godot;
|
||||
using Newlon.Components.Level;
|
||||
|
||||
namespace Newlon.Components.Plants;
|
||||
|
||||
// Shoot component of some plants
|
||||
public partial class Shooter : Node2D
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
namespace Newlon.Components.Plants.Behaviours;
|
||||
|
||||
public partial class PeashooterBehaviour : Node
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
using Godot;
|
||||
|
||||
namespace Newlon.Components.Plants.Behaviours;
|
||||
|
||||
public partial class PotatomineBehaviour : Node
|
||||
{
|
||||
[Export] private AnimationPlayer _player;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
namespace Newlon.Components.Plants.Behaviours;
|
||||
|
||||
public partial class SpikeweedBehaviour : Node
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
namespace Newlon.Components.Plants.Behaviours;
|
||||
|
||||
public partial class SunflowerBehaviour : Node
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
namespace Newlon.Components.Plants.Behaviours;
|
||||
|
||||
public partial class WallnutBehaviour : Node
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
namespace Newlon.Components.Zombies;
|
||||
|
||||
public partial class AudioDamage : AudioStreamPlayer2D
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
using Godot;
|
||||
using System;
|
||||
using Newlon.Components.Plants;
|
||||
|
||||
|
||||
namespace Newlon.Components.Zombies;
|
||||
|
||||
public partial class EatBox : Area2D
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
namespace Newlon.Components.Zombies;
|
||||
|
||||
public partial class RuntimeZombieData : Node2D, IEntity
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
namespace Newlon.Components.Zombies;
|
||||
|
||||
public partial class ZombieMover : Node
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
namespace Newlon.Components.Zombies.Behaviours;
|
||||
|
||||
public partial class BasicZombieBehaviour : Node
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue