Move Player logic to other project
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using Chickensoft.GodotNodeInterfaces;
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.Serialization;
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace Zennysoft.Game.Ma;
|
||||
public partial class MapLogic
|
||||
{
|
||||
public static class Input
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://bn0l0ur7ih0ea
|
||||
@@ -1,16 +0,0 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.LogicBlocks;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public partial class MapLogic
|
||||
{
|
||||
[Meta]
|
||||
public partial record State : StateLogic<State>
|
||||
{
|
||||
public State()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://bf2bas1ky7ae1
|
||||
@@ -1,13 +0,0 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.LogicBlocks;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public interface IMapLogic : ILogicBlock<MapLogic.State>;
|
||||
|
||||
[Meta]
|
||||
[LogicBlock(typeof(State))]
|
||||
public partial class MapLogic : LogicBlock<MapLogic.State>, IMapLogic
|
||||
{
|
||||
public override Transition GetInitialState() => To<State>();
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://dhjrhbhvpduqn
|
||||
@@ -1,7 +1,6 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.GodotNodeInterfaces;
|
||||
using Chickensoft.Introspection;
|
||||
using Zennysoft.Game.Ma;
|
||||
using Godot;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
@@ -209,6 +209,10 @@ public partial class Player : CharacterBody3D, IPlayer
|
||||
})
|
||||
.Handle((in PlayerLogic.Output.ThrowItem output) =>
|
||||
{
|
||||
})
|
||||
.Handle((in PlayerLogic.Output.Move output) =>
|
||||
{
|
||||
Move(output.delta);
|
||||
});
|
||||
|
||||
GameChunk.AddChunk(PlayerChunk);
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
using Godot;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public partial class PlayerLogic
|
||||
{
|
||||
public static class Input
|
||||
{
|
||||
public readonly record struct PhysicsTick(double Delta);
|
||||
|
||||
public readonly record struct Moved(Vector3 GlobalPosition, Transform3D GlobalTransform);
|
||||
|
||||
public readonly record struct Enable;
|
||||
|
||||
public readonly record struct Attack;
|
||||
|
||||
public readonly record struct AttackAnimationFinished;
|
||||
|
||||
public readonly record struct Killed;
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://ch6oc0relbray
|
||||
@@ -1,14 +0,0 @@
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public partial class PlayerLogic
|
||||
{
|
||||
public static class Output
|
||||
{
|
||||
public static class Animations
|
||||
{
|
||||
public readonly record struct Attack;
|
||||
}
|
||||
|
||||
public readonly record struct ThrowItem;
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://cylnjf8jadgo6
|
||||
@@ -1,13 +0,0 @@
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public partial class PlayerLogic
|
||||
{
|
||||
public record Settings
|
||||
{
|
||||
public float MoveSpeed { get; set; }
|
||||
|
||||
public float RotationSpeed { get; set; }
|
||||
|
||||
public float Acceleration { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://cmbt77ty7pmvc
|
||||
@@ -1,10 +0,0 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.LogicBlocks;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public partial class PlayerLogic
|
||||
{
|
||||
[Meta]
|
||||
public abstract partial record State : StateLogic<State>;
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://c46w8aytsajoe
|
||||
@@ -1,13 +0,0 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.LogicBlocks;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public interface IPlayerLogic : ILogicBlock<PlayerLogic.State>;
|
||||
|
||||
[Meta, Id("player_logic")]
|
||||
[LogicBlock(typeof(State), Diagram = true)]
|
||||
public partial class PlayerLogic : LogicBlock<PlayerLogic.State>, IPlayerLogic
|
||||
{
|
||||
public override Transition GetInitialState() => To<State.Idle>();
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://beqr05mbwbg3b
|
||||
@@ -1,20 +0,0 @@
|
||||
@startuml PlayerLogic
|
||||
state "PlayerLogic State" as Zennysoft_Game_Ma_PlayerLogic_State {
|
||||
state "Alive" as Zennysoft_Game_Ma_PlayerLogic_State_Alive {
|
||||
state "Attacking" as Zennysoft_Game_Ma_PlayerLogic_State_Attacking
|
||||
state "Idle" as Zennysoft_Game_Ma_PlayerLogic_State_Idle
|
||||
}
|
||||
state "Dead" as Zennysoft_Game_Ma_PlayerLogic_State_Dead
|
||||
state "Disabled" as Zennysoft_Game_Ma_PlayerLogic_State_Disabled
|
||||
}
|
||||
|
||||
Zennysoft_Game_Ma_PlayerLogic_State_Alive --> Zennysoft_Game_Ma_PlayerLogic_State_Alive : PhysicsTick
|
||||
Zennysoft_Game_Ma_PlayerLogic_State_Alive --> Zennysoft_Game_Ma_PlayerLogic_State_Dead : Killed
|
||||
Zennysoft_Game_Ma_PlayerLogic_State_Attacking --> Zennysoft_Game_Ma_PlayerLogic_State_Idle : AttackAnimationFinished
|
||||
Zennysoft_Game_Ma_PlayerLogic_State_Disabled --> Zennysoft_Game_Ma_PlayerLogic_State_Idle : Enable
|
||||
Zennysoft_Game_Ma_PlayerLogic_State_Idle --> Zennysoft_Game_Ma_PlayerLogic_State_Attacking : Attack
|
||||
|
||||
Zennysoft_Game_Ma_PlayerLogic_State_Idle : OnAttack → Attack
|
||||
|
||||
[*] --> Zennysoft_Game_Ma_PlayerLogic_State_Idle
|
||||
@enduml
|
||||
@@ -1,18 +0,0 @@
|
||||
using Chickensoft.Introspection;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public partial class PlayerLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta]
|
||||
public partial record Attacking : Alive, IGet<Input.AttackAnimationFinished>
|
||||
{
|
||||
public Transition On(in Input.AttackAnimationFinished input)
|
||||
{
|
||||
return To<Idle>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://dyrl0x5q3q5j7
|
||||
@@ -1,22 +0,0 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public partial class PlayerLogic
|
||||
{
|
||||
public abstract partial record State
|
||||
{
|
||||
[Meta, Id("player_logic_state_alive_idle")]
|
||||
public partial record Idle : Alive, IGet<Input.Attack>
|
||||
{
|
||||
|
||||
public virtual Transition On(in Input.Attack input)
|
||||
{
|
||||
GD.Print("Attacking...");
|
||||
Output(new Output.Animations.Attack());
|
||||
return To<Attacking>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://i0g8tve28n70
|
||||
@@ -1,28 +0,0 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public partial class PlayerLogic
|
||||
{
|
||||
public partial record State
|
||||
{
|
||||
[Meta, Id("player_logic_alive")]
|
||||
public abstract partial record Alive : State, IGet<Input.PhysicsTick>, IGet<Input.Killed>
|
||||
{
|
||||
public virtual Transition On(in Input.PhysicsTick input)
|
||||
{
|
||||
var delta = input.Delta;
|
||||
var player = Get<IPlayer>();
|
||||
player.Move((float)delta);
|
||||
return ToSelf();
|
||||
}
|
||||
|
||||
public Transition On(in Input.Killed input)
|
||||
{
|
||||
GD.Print("Player died");
|
||||
return To<Dead>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://demor6ic4xcwn
|
||||
@@ -1,12 +0,0 @@
|
||||
using Chickensoft.Introspection;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public partial class PlayerLogic
|
||||
{
|
||||
public abstract partial record State
|
||||
{
|
||||
[Meta, Id("player_logic_state_dead")]
|
||||
public partial record Dead : State;
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://bsxp82sus11pv
|
||||
@@ -1,24 +0,0 @@
|
||||
using Chickensoft.Introspection;
|
||||
using Zennysoft.Game.Abstractions;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public partial class PlayerLogic
|
||||
{
|
||||
public abstract partial record State
|
||||
{
|
||||
[Meta, Id("player_logic_state_disabled")]
|
||||
public partial record Disabled : State, IGet<Input.Enable>
|
||||
{
|
||||
public Disabled()
|
||||
{
|
||||
OnAttach(() => Get<IAppRepo>().GameEntered += OnGameEntered);
|
||||
OnDetach(() => Get<IAppRepo>().GameEntered -= OnGameEntered);
|
||||
}
|
||||
|
||||
public Transition On(in Input.Enable input) => To<Idle>();
|
||||
|
||||
public void OnGameEntered() => Input(new Input.Enable());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://pbj8nbyp8iwr
|
||||
Reference in New Issue
Block a user