Move GameLogic to new project

This commit is contained in:
2025-03-07 01:39:18 -08:00
parent b7bf4f3d10
commit 65e4af8595
28 changed files with 33 additions and 25 deletions

View File

@@ -5,6 +5,7 @@ using Chickensoft.Introspection;
using Chickensoft.SaveFileBuilder;
using Godot;
using Godot.Collections;
using SimpleInjector;
using System;
using System.Linq;
using Zennysoft.Game.Ma.Implementation;
@@ -44,7 +45,7 @@ public partial class Player : CharacterBody3D, IPlayer
private PlayerLogic.Settings Settings { get; set; } = default!;
private PlayerLogic PlayerLogic { get; set; } = default!;
private IPlayerLogic PlayerLogic { get; set; } = default!;
#region Dependencies
@@ -116,6 +117,10 @@ public partial class Player : CharacterBody3D, IPlayer
public void Setup()
{
var container = new SimpleInjector.Container();
container.Register<IPlayerLogic, PlayerLogic>(Lifestyle.Singleton);
container.Verify();
Settings = new PlayerLogic.Settings() { RotationSpeed = PlayerStatResource.RotationSpeed, MoveSpeed = PlayerStatResource.MoveSpeed, Acceleration = PlayerStatResource.Acceleration };
Stats = new PlayerStatController();
Stats.Init(
@@ -139,7 +144,7 @@ public partial class Player : CharacterBody3D, IPlayer
Inventory = new Inventory();
PlayerLogic = new PlayerLogic();
PlayerLogic = container.GetInstance<IPlayerLogic>();
PlayerLogic.Set(this as IPlayer);
PlayerLogic.Set(Settings);
PlayerLogic.Set(Stats);