Skip to content

Commit

Permalink
Merge pull request #3364 from KBVE/dev
Browse files Browse the repository at this point in the history
Preparing Alpha Branch
  • Loading branch information
h0lybyte authored Nov 25, 2024
2 parents 85f2df9 + 2b54e48 commit e1acf8b
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 27 deletions.
2 changes: 1 addition & 1 deletion packages/kilonet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Started the IFrame Interactions but need to fix the cross origin issue.
Added the `com.unity.transport` to the packages.
Preparing the Discord build - ETA 12 hours.
Adding new tilemap generator script and fixed some asmdefs.
Triggering another build once more!
Triggering another build once more, oh boi, another docker build.

- [KBVE](https://kbve.com/)
- [RareIcon](https://rareicon.com/)
4 changes: 2 additions & 2 deletions packages/kilonet/kilonet/KBVEGameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
namespace KBVE.Kilonet
{

public class GameManager : MonoBehaviour
public class KBVEGameManager : MonoBehaviour
{
public static GameManager Instance { get; private set; }
public static KBVEGameManager Instance { get; private set; }

private StateMachine stateMachine;

Expand Down
2 changes: 1 addition & 1 deletion packages/mmextensions/Kbve.MMExtensions.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"MoreMountains.Tools",
"MoreMountains.TopDownEngine",
"VContainer",
"KBVE.Kilonet"
"Kbve.Kilonet"
],
"includePlatforms": [],
"excludePlatforms": [],
Expand Down
36 changes: 13 additions & 23 deletions packages/mmextensions/mmextensions/Shaco/GameLifetimeScope.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using UnityEngine;
using VContainer;
using VContainer.Unity;
using MoreMountains.Tools;
using MoreMountains.TopDownEngine;
using KBVE.Kilonet;

namespace KBVE.MMExtensions.Shaco
Expand All @@ -13,33 +15,21 @@ public class GameLifetimeScope : LifetimeScope
[SerializeField]
private GameObject remotePlayerPrefab;

[SerializeField]
private GameObject gameManagerPrefab;

protected override void Configure(IContainerBuilder builder)
{
// Register GameManager

builder
.RegisterComponentInHierarchy<GameManager>()
.OnInitialized(
(resolver, gameManager) =>
{
gameManager.TargetFrameRate = 300;
gameManager.MaximumLives = 0;
gameManager.CurrentLives = 0;
gameManager.GameOverScene = "Title";
gameManager.PauseGameWhenInventoryOpens = false;
}
);




// builder.Register<NetworkManager>(Lifetime.Singleton);
// builder.Register<PlayerManager>(Lifetime.Singleton);
builder.UseComponents(components =>
{
var gameManager = Object.Instantiate(gameManagerPrefab).GetComponent<GameManager>();
DontDestroyOnLoad(gameManager.gameObject);
components.AddInstance(gameManager);

// builder.Register<LevelManager>(Lifetime.Singleton).WithParameter(localPlayerPrefab);
// builder.Register<MultiplayerManager>(Lifetime.Singleton).WithParameter(remotePlayerPrefab);
});

// builder.Register<PlayerPool>(Lifetime.Singleton).WithParameter(remotePlayerPrefab);
// Register the EntryPoint for GameManager initialization
builder.RegisterEntryPoint<GameManagerEntryPoint>();
}
}
}
28 changes: 28 additions & 0 deletions packages/mmextensions/mmextensions/Shaco/GameManagerEntryPoint.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using UnityEngine;
using VContainer;
using VContainer.Unity;
using MoreMountains.TopDownEngine;

namespace KBVE.MMExtensions.Shaco
{
public class GameManagerEntryPoint : IStartable
{
private readonly GameManager _gameManager;

public GameManagerEntryPoint(GameManager gameManager)
{
_gameManager = gameManager;
}

public void Start()
{
// Initialize GameManager values
_gameManager.TargetFrameRate = 60;
_gameManager.MaximumLives = 5;
_gameManager.CurrentLives = 5;
_gameManager.GameOverScene = "GameOver";

Debug.Log("GameManager initialized via EntryPoint!");
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e1acf8b

Please sign in to comment.