Move files and folders to new repo format to enable multi-project format

This commit is contained in:
2025-03-06 22:07:25 -08:00
parent 12cbb82ac9
commit a09f6ec5a5
3973 changed files with 1781 additions and 2938 deletions

View File

@@ -0,0 +1,28 @@
using Godot;
namespace Zennysoft.Game.Ma;
public partial class EnemyLogic
{
public static class Input
{
public readonly record struct Alerted;
public readonly record struct LostPlayer;
public readonly record struct PhysicsTick(double Delta);
public readonly record struct EnemyDefeated;
public readonly record struct StartPatrol;
public readonly record struct StopMoving;
public readonly record struct PatrolToRandomSpot(Vector3 PatrolTarget);
public readonly record struct AttackTimer;
public readonly record struct StartAttacking;
}
}

View File

@@ -0,0 +1 @@
uid://3eomlwtoa5gh

View File

@@ -0,0 +1,17 @@
using Godot;
namespace Zennysoft.Game.Ma;
public partial class EnemyLogic
{
public static class Output
{
public readonly record struct MoveTowardsPlayer(Vector3 TargetPosition);
public readonly record struct MovementComputed(Vector3 LinearVelocity);
public readonly record struct TakeAction;
public readonly record struct Defeated;
}
}

View File

@@ -0,0 +1 @@
uid://qt0ywaq3twyi

View File

@@ -0,0 +1,6 @@
namespace Zennysoft.Game.Ma;
public partial class EnemyLogic
{
public record Settings(float MaximumHP);
}

View File

@@ -0,0 +1 @@
uid://c2l63fmbe6pv0

View File

@@ -0,0 +1,15 @@
using Chickensoft.Introspection;
using Chickensoft.LogicBlocks;
namespace Zennysoft.Game.Ma;
public partial class EnemyLogic
{
[Meta]
public abstract partial record State : StateLogic<State>
{
protected State()
{
}
}
}

View File

@@ -0,0 +1 @@
uid://khen7dv6jonr

View File

@@ -0,0 +1,13 @@
using Chickensoft.Introspection;
using Chickensoft.LogicBlocks;
namespace Zennysoft.Game.Ma;
public interface IEnemyLogic : ILogicBlock<EnemyLogic.State>;
[Meta, Id("enemy_logic")]
[LogicBlock(typeof(State), Diagram = true)]
public partial class EnemyLogic : LogicBlock<EnemyLogic.State>, IEnemyLogic
{
public override Transition GetInitialState() => To<State.Idle>();
}

View File

@@ -0,0 +1 @@
uid://drtfk0gf5q8fv

View File

@@ -0,0 +1,31 @@
@startuml EnemyLogic
state "EnemyLogic State" as Zennysoft_Game_Ma_EnemyLogic_State {
state "Alive" as Zennysoft_Game_Ma_EnemyLogic_State_Alive {
state "Activated" as Zennysoft_Game_Ma_EnemyLogic_State_Activated {
state "Attacking" as Zennysoft_Game_Ma_EnemyLogic_State_Attacking
state "FollowPlayer" as Zennysoft_Game_Ma_EnemyLogic_State_FollowPlayer
state "Patrolling" as Zennysoft_Game_Ma_EnemyLogic_State_Patrolling
}
state "Idle" as Zennysoft_Game_Ma_EnemyLogic_State_Idle
}
state "Defeated" as Zennysoft_Game_Ma_EnemyLogic_State_Defeated
}
Zennysoft_Game_Ma_EnemyLogic_State_Alive --> Zennysoft_Game_Ma_EnemyLogic_State_Attacking : AttackTimer
Zennysoft_Game_Ma_EnemyLogic_State_Alive --> Zennysoft_Game_Ma_EnemyLogic_State_Attacking : StartAttacking
Zennysoft_Game_Ma_EnemyLogic_State_Alive --> Zennysoft_Game_Ma_EnemyLogic_State_Defeated : EnemyDefeated
Zennysoft_Game_Ma_EnemyLogic_State_Alive --> Zennysoft_Game_Ma_EnemyLogic_State_FollowPlayer : Alerted
Zennysoft_Game_Ma_EnemyLogic_State_Alive --> Zennysoft_Game_Ma_EnemyLogic_State_Idle : StopMoving
Zennysoft_Game_Ma_EnemyLogic_State_Attacking --> Zennysoft_Game_Ma_EnemyLogic_State_Idle : StopMoving
Zennysoft_Game_Ma_EnemyLogic_State_FollowPlayer --> Zennysoft_Game_Ma_EnemyLogic_State_FollowPlayer : PhysicsTick
Zennysoft_Game_Ma_EnemyLogic_State_FollowPlayer --> Zennysoft_Game_Ma_EnemyLogic_State_Idle : LostPlayer
Zennysoft_Game_Ma_EnemyLogic_State_Idle --> Zennysoft_Game_Ma_EnemyLogic_State_Patrolling : StartPatrol
Zennysoft_Game_Ma_EnemyLogic_State_Patrolling --> Zennysoft_Game_Ma_EnemyLogic_State_Idle : StopMoving
Zennysoft_Game_Ma_EnemyLogic_State_Patrolling --> Zennysoft_Game_Ma_EnemyLogic_State_Patrolling : PatrolToRandomSpot
Zennysoft_Game_Ma_EnemyLogic_State_Patrolling --> Zennysoft_Game_Ma_EnemyLogic_State_Patrolling : PhysicsTick
Zennysoft_Game_Ma_EnemyLogic_State_Alive : OnAttackTimer → TakeAction
Zennysoft_Game_Ma_EnemyLogic_State_Alive : OnEnemyDefeated → Defeated
[*] --> Zennysoft_Game_Ma_EnemyLogic_State_Idle
@enduml

View File

@@ -0,0 +1,18 @@
using Chickensoft.Introspection;
using Godot;
namespace Zennysoft.Game.Ma;
public partial class EnemyLogic
{
public partial record State
{
[Meta, Id("enemy_logic_state_activated")]
public partial record Activated : Alive
{
public Activated()
{
}
}
}
}

View File

@@ -0,0 +1 @@
uid://cujrm0s648hrh

View File

@@ -0,0 +1,45 @@
using Chickensoft.Introspection;
namespace Zennysoft.Game.Ma;
public partial class EnemyLogic
{
public partial record State
{
[Meta, Id("enemy_logic_state_alive")]
public abstract partial record Alive : State, IGet<Input.AttackTimer>, IGet<Input.EnemyDefeated>, IGet<Input.StopMoving>, IGet<Input.StartAttacking>, IGet<Input.Alerted>
{
public Transition On(in Input.AttackTimer input)
{
Output(new Output.TakeAction());
return To<Attacking>();
}
public Transition On(in Input.EnemyDefeated input)
{
Output(new Output.Defeated());
return To<Defeated>();
}
public Transition On(in Input.StopMoving input)
{
return To<Idle>();
}
public Transition On(in Input.StartAttacking input)
{
return To<Attacking>();
}
public Transition On(in Input.Alerted _)
{
var enemy = Get<IEnemy>();
if (enemy is IHasRangedAttack rangedAttacker)
rangedAttacker.RangedAttack();
if (enemy is Chinthe chinthe)
chinthe.Activate();
return To<FollowPlayer>();
}
}
}
}

View File

@@ -0,0 +1 @@
uid://bcv7ni2yv4esm

View File

@@ -0,0 +1,19 @@
using Chickensoft.Introspection;
namespace Zennysoft.Game.Ma;
public partial class EnemyLogic
{
public partial record State
{
[Meta, Id("enemy_logic_state_attacking")]
public partial record Attacking : Activated, IGet<Input.StopMoving>
{
public Attacking()
{
OnAttach(() => Get<IEnemy>().StartAttackTimer());
OnDetach(() => Get<IEnemy>().StopAttackTimer());
}
}
}
}

View File

@@ -0,0 +1 @@
uid://bnt1sybkq46uk

View File

@@ -0,0 +1,15 @@
using Chickensoft.Introspection;
using static Zennysoft.Game.Ma.EnemyLogic.Input;
namespace Zennysoft.Game.Ma;
public partial class EnemyLogic
{
public partial record State
{
[Meta, Id("enemy_logic_state_defeated")]
public partial record Defeated : State
{
}
}
}

View File

@@ -0,0 +1 @@
uid://bqxmgmbfkbi27

View File

@@ -0,0 +1,27 @@
using Chickensoft.Introspection;
namespace Zennysoft.Game.Ma;
public partial class EnemyLogic
{
public partial record State
{
[Meta, Id("enemy_logic_state_followplayer")]
public partial record FollowPlayer : Activated, IGet<Input.PhysicsTick>, IGet<Input.LostPlayer>
{
public Transition On(in Input.PhysicsTick input)
{
var enemy = Get<IEnemy>();
var player = Get<IPlayer>();
var target = player.CurrentPosition;
enemy.SetTarget(target);
return ToSelf();
}
public Transition On(in Input.LostPlayer input)
{
return To<Idle>();
}
}
}
}

View File

@@ -0,0 +1 @@
uid://bm8sgtebp1ntj

View File

@@ -0,0 +1,19 @@
using Chickensoft.Introspection;
using Godot;
namespace Zennysoft.Game.Ma;
public partial class EnemyLogic
{
public partial record State
{
[Meta, Id("enemy_logic_state_idle")]
public partial record Idle : Alive, IGet<Input.StartPatrol>
{
public Transition On(in Input.StartPatrol _)
{
return To<Patrolling>();
}
}
}
}

View File

@@ -0,0 +1 @@
uid://bfpamukd1qe3t

View File

@@ -0,0 +1,31 @@
using Chickensoft.Introspection;
using Godot;
using Org.BouncyCastle.Asn1.X509;
namespace Zennysoft.Game.Ma;
public partial class EnemyLogic
{
public partial record State
{
[Meta, Id("enemy_logic_state_patrolling")]
public partial record Patrolling : Activated, IGet<Input.PhysicsTick>, IGet<Input.PatrolToRandomSpot>, IGet<Input.StopMoving>
{
private Vector3 _patrolTarget { get; set; }
public Transition On(in Input.PhysicsTick input)
{
var delta = input.Delta;
var enemy = Get<IEnemy>();
enemy.SetTarget(_patrolTarget);
return ToSelf();
}
public Transition On(in Input.PatrolToRandomSpot input)
{
_patrolTarget = input.PatrolTarget;
return ToSelf();
}
}
}
}

View File

@@ -0,0 +1 @@
uid://bl1wq25d7in2j