Move GameLogic to new project
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user