Move files and folders to new repo format to enable multi-project format
This commit is contained in:
28
Zennysoft.Game.Ma/src/enemy/state/EnemyLogic.Input.cs
Normal file
28
Zennysoft.Game.Ma/src/enemy/state/EnemyLogic.Input.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://3eomlwtoa5gh
|
||||
17
Zennysoft.Game.Ma/src/enemy/state/EnemyLogic.Output.cs
Normal file
17
Zennysoft.Game.Ma/src/enemy/state/EnemyLogic.Output.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://qt0ywaq3twyi
|
||||
6
Zennysoft.Game.Ma/src/enemy/state/EnemyLogic.Settings.cs
Normal file
6
Zennysoft.Game.Ma/src/enemy/state/EnemyLogic.Settings.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public partial class EnemyLogic
|
||||
{
|
||||
public record Settings(float MaximumHP);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://c2l63fmbe6pv0
|
||||
15
Zennysoft.Game.Ma/src/enemy/state/EnemyLogic.State.cs
Normal file
15
Zennysoft.Game.Ma/src/enemy/state/EnemyLogic.State.cs
Normal 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()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://khen7dv6jonr
|
||||
13
Zennysoft.Game.Ma/src/enemy/state/EnemyLogic.cs
Normal file
13
Zennysoft.Game.Ma/src/enemy/state/EnemyLogic.cs
Normal 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>();
|
||||
}
|
||||
1
Zennysoft.Game.Ma/src/enemy/state/EnemyLogic.cs.uid
Normal file
1
Zennysoft.Game.Ma/src/enemy/state/EnemyLogic.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://drtfk0gf5q8fv
|
||||
31
Zennysoft.Game.Ma/src/enemy/state/EnemyLogic.g.puml
Normal file
31
Zennysoft.Game.Ma/src/enemy/state/EnemyLogic.g.puml
Normal 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
|
||||
@@ -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()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://cujrm0s648hrh
|
||||
@@ -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>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://bcv7ni2yv4esm
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://bnt1sybkq46uk
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://bqxmgmbfkbi27
|
||||
@@ -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>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://bm8sgtebp1ntj
|
||||
@@ -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>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://bfpamukd1qe3t
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://bl1wq25d7in2j
|
||||
Reference in New Issue
Block a user