Move files and folders to new repo format to enable multi-project format
This commit is contained in:
19
Zennysoft.Game.Ma/src/boss/state/BossLogic.Input.cs
Normal file
19
Zennysoft.Game.Ma/src/boss/state/BossLogic.Input.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public partial class BossLogic
|
||||
{
|
||||
public static class Input
|
||||
{
|
||||
public readonly record struct Activate;
|
||||
|
||||
public readonly record struct PhysicsTick(double Delta);
|
||||
|
||||
public readonly record struct StopMoving;
|
||||
|
||||
public readonly record struct AttackTimer;
|
||||
|
||||
public readonly record struct StartAttacking;
|
||||
|
||||
public readonly record struct BossDefeated;
|
||||
}
|
||||
}
|
||||
1
Zennysoft.Game.Ma/src/boss/state/BossLogic.Input.cs.uid
Normal file
1
Zennysoft.Game.Ma/src/boss/state/BossLogic.Input.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cc1wadksmbq6h
|
||||
17
Zennysoft.Game.Ma/src/boss/state/BossLogic.Output.cs
Normal file
17
Zennysoft.Game.Ma/src/boss/state/BossLogic.Output.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Godot;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public partial class BossLogic
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
1
Zennysoft.Game.Ma/src/boss/state/BossLogic.Output.cs.uid
Normal file
1
Zennysoft.Game.Ma/src/boss/state/BossLogic.Output.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://c7r8l4w4nwd8x
|
||||
15
Zennysoft.Game.Ma/src/boss/state/BossLogic.State.cs
Normal file
15
Zennysoft.Game.Ma/src/boss/state/BossLogic.State.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.LogicBlocks;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public partial class BossLogic
|
||||
{
|
||||
[Meta]
|
||||
public abstract partial record State : StateLogic<State>
|
||||
{
|
||||
protected State()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
1
Zennysoft.Game.Ma/src/boss/state/BossLogic.State.cs.uid
Normal file
1
Zennysoft.Game.Ma/src/boss/state/BossLogic.State.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://ds1hjuenunrht
|
||||
13
Zennysoft.Game.Ma/src/boss/state/BossLogic.cs
Normal file
13
Zennysoft.Game.Ma/src/boss/state/BossLogic.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.LogicBlocks;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public interface IBossLogic : ILogicBlock<BossLogic.State>;
|
||||
|
||||
[Meta, Id("boss_logic")]
|
||||
[LogicBlock(typeof(State), Diagram = true)]
|
||||
public partial class BossLogic : LogicBlock<BossLogic.State>, IBossLogic
|
||||
{
|
||||
public override Transition GetInitialState() => To<State.Unactivated>();
|
||||
}
|
||||
1
Zennysoft.Game.Ma/src/boss/state/BossLogic.cs.uid
Normal file
1
Zennysoft.Game.Ma/src/boss/state/BossLogic.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dnpj001c3iabh
|
||||
29
Zennysoft.Game.Ma/src/boss/state/BossLogic.g.puml
Normal file
29
Zennysoft.Game.Ma/src/boss/state/BossLogic.g.puml
Normal file
@@ -0,0 +1,29 @@
|
||||
@startuml BossLogic
|
||||
state "BossLogic State" as GameJamDungeon_BossLogic_State {
|
||||
state "Defeated" as GameJamDungeon_BossLogic_State_Defeated
|
||||
state "Alive" as GameJamDungeon_BossLogic_State_Alive {
|
||||
state "Idle" as GameJamDungeon_BossLogic_State_Idle
|
||||
state "EngagePlayer" as GameJamDungeon_BossLogic_State_EngagePlayer
|
||||
state "ApproachPlayer" as GameJamDungeon_BossLogic_State_ApproachPlayer
|
||||
state "Activated" as GameJamDungeon_BossLogic_State_Activated {
|
||||
state "Attacking" as GameJamDungeon_BossLogic_State_Attacking
|
||||
state "FollowPlayer" as GameJamDungeon_BossLogic_State_FollowPlayer
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GameJamDungeon_BossLogic_State_Alive --> GameJamDungeon_BossLogic_State_Defeated : BossDefeated
|
||||
GameJamDungeon_BossLogic_State_ApproachPlayer --> GameJamDungeon_BossLogic_State_ApproachPlayer : PhysicsTick
|
||||
GameJamDungeon_BossLogic_State_ApproachPlayer --> GameJamDungeon_BossLogic_State_EngagePlayer : PhysicsTick
|
||||
GameJamDungeon_BossLogic_State_EngagePlayer --> GameJamDungeon_BossLogic_State_ApproachPlayer : PhysicsTick
|
||||
GameJamDungeon_BossLogic_State_EngagePlayer --> GameJamDungeon_BossLogic_State_EngagePlayer : PhysicsTick
|
||||
GameJamDungeon_BossLogic_State_EngagePlayer --> GameJamDungeon_BossLogic_State_EngagePlayer : PrimaryAttack
|
||||
GameJamDungeon_BossLogic_State_EngagePlayer --> GameJamDungeon_BossLogic_State_EngagePlayer : SecondaryAttack
|
||||
GameJamDungeon_BossLogic_State_FollowPlayer --> GameJamDungeon_BossLogic_State_FollowPlayer : PhysicsTick
|
||||
GameJamDungeon_BossLogic_State_Idle --> GameJamDungeon_BossLogic_State_ApproachPlayer : Activate
|
||||
|
||||
GameJamDungeon_BossLogic_State : On() → Defeated
|
||||
GameJamDungeon_BossLogic_State_Alive : OnBossDefeated → Defeated
|
||||
|
||||
[*] --> GameJamDungeon_BossLogic_State_Idle
|
||||
@enduml
|
||||
@@ -0,0 +1,14 @@
|
||||
using Chickensoft.Introspection;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public partial class BossLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta, Id("boss_logic_state_activated")]
|
||||
public partial record Activated : Alive
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://dk60nmw42pm82
|
||||
@@ -0,0 +1,37 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public partial class BossLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta, Id("boss_logic_state_alive")]
|
||||
public abstract partial record Alive : State, IGet<Input.BossDefeated>, IGet<Input.AttackTimer>, IGet<Input.StopMoving>, IGet<Input.StartAttacking>
|
||||
{
|
||||
}
|
||||
|
||||
public Transition On(in Input.AttackTimer input)
|
||||
{
|
||||
Output(new Output.TakeAction());
|
||||
return To<Attacking>();
|
||||
}
|
||||
|
||||
public Transition On(in Input.BossDefeated 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>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://bbwhocehdcsbt
|
||||
@@ -0,0 +1,33 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public partial class BossLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta, Id("boss_logic_state_approach_player")]
|
||||
public partial record ApproachPlayer : Alive, IGet<Input.PhysicsTick>
|
||||
{
|
||||
public Transition On(in Input.PhysicsTick input)
|
||||
{
|
||||
var boss = Get<IBoss>();
|
||||
var player = Get<IPlayer>();
|
||||
var delta = (float)input.Delta;
|
||||
|
||||
var playerPosition = new Vector3(player.CurrentPosition.X, boss.GlobalPosition.Y, player.CurrentPosition.Z);
|
||||
|
||||
if (boss.GlobalPosition.DistanceTo(player.CurrentPosition) <= 5.0f)
|
||||
return To<EngagePlayer>();
|
||||
|
||||
var moveToward = boss.GlobalPosition.MoveToward(playerPosition, (float)delta * 3f);
|
||||
boss.GlobalPosition = moveToward;
|
||||
|
||||
var targetDirection = boss.GlobalPosition - player.CurrentPosition;
|
||||
boss.GlobalRotation = new Vector3(boss.GlobalRotation.X, Mathf.LerpAngle(boss.GlobalRotation.Y, Mathf.Atan2(-targetDirection.X, -targetDirection.Z), delta * 3f), boss.GlobalRotation.Z);
|
||||
return ToSelf();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://crhdnddatd7ap
|
||||
@@ -0,0 +1,19 @@
|
||||
using Chickensoft.Introspection;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public partial class BossLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta, Id("boss_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://crsw8t5nr4ots
|
||||
@@ -0,0 +1,14 @@
|
||||
using Chickensoft.Introspection;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public partial class BossLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta, Id("boss_logic_state_defeated")]
|
||||
public partial record Defeated : State
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://beymhvkyuay4h
|
||||
@@ -0,0 +1,31 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public partial class BossLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta, Id("boss_logic_state_engage_player")]
|
||||
public partial record EngagePlayer : Alive, IGet<Input.PhysicsTick>
|
||||
{
|
||||
public EngagePlayer()
|
||||
{
|
||||
}
|
||||
|
||||
public Transition On(in Input.PhysicsTick input)
|
||||
{
|
||||
var boss = Get<IBoss>();
|
||||
var player = Get<IPlayer>();
|
||||
var delta = (float)input.Delta;
|
||||
var targetDirection = boss.GlobalPosition - player.CurrentPosition;
|
||||
boss.GlobalRotation = new Vector3(boss.GlobalRotation.X, Mathf.LerpAngle(boss.GlobalRotation.Y, Mathf.Atan2(-targetDirection.X, -targetDirection.Z), delta * 3f), boss.GlobalRotation.Z);
|
||||
if (boss.GlobalPosition.DistanceTo(player.CurrentPosition) > 5.0f)
|
||||
return To<ApproachPlayer>();
|
||||
|
||||
return ToSelf();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://bvwwpwvlou5gg
|
||||
@@ -0,0 +1,22 @@
|
||||
using Chickensoft.Introspection;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public partial class BossLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta, Id("boss_logic_state_followplayer")]
|
||||
public partial record FollowPlayer : Activated, IGet<Input.PhysicsTick>
|
||||
{
|
||||
public Transition On(in Input.PhysicsTick input)
|
||||
{
|
||||
var enemy = Get<IEnemy>();
|
||||
var player = Get<IPlayer>();
|
||||
var target = player.CurrentPosition;
|
||||
enemy.SetTarget(target);
|
||||
return ToSelf();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://0uou7c2gl6jr
|
||||
@@ -0,0 +1,28 @@
|
||||
using Chickensoft.Introspection;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public partial class BossLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta, Id("boss_logic_state_idle")]
|
||||
public partial record Idle : Alive, IGet<Input.Activate>
|
||||
{
|
||||
public Idle()
|
||||
{
|
||||
OnDetach(() =>
|
||||
{
|
||||
var boss = Get<IBoss>();
|
||||
boss.SetPhysicsProcess(true);
|
||||
boss.Show();
|
||||
}
|
||||
);
|
||||
}
|
||||
public Transition On(in Input.Activate input)
|
||||
{
|
||||
return To<ApproachPlayer>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://h4f0q5o6nolw
|
||||
@@ -0,0 +1,18 @@
|
||||
using Chickensoft.Introspection;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public partial class BossLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta, Id("boss_logic_state_unactivated")]
|
||||
public partial record Unactivated : State, IGet<Input.Activate>
|
||||
{
|
||||
public Transition On(in Input.Activate input)
|
||||
{
|
||||
return To<Activated>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://hns6fpqiyru2
|
||||
Reference in New Issue
Block a user