feat: more plugin work and intra-scope communication
This commit is contained in:
+6
-1
@@ -1,15 +1,20 @@
|
||||
using Godot;
|
||||
using GodotHostTest.GodotDI;
|
||||
using GodotHostTest.Interfaces;
|
||||
|
||||
namespace GodotHostTest.Game;
|
||||
|
||||
public partial class Root : Node2D
|
||||
{
|
||||
[Inject] private readonly ICurrentLevel _currentLevel = null!;
|
||||
[Inject] private readonly ILevelDataProvider _levelDataProvider = null!;
|
||||
[Inject] private readonly ISceneInstantiator _sceneInstantiator = null!;
|
||||
[Export] private PackedScene _levelScene = null!;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
AddChild(_sceneInstantiator.Instantiate(_levelScene));
|
||||
var levelData = _levelDataProvider.GetLevelData(_currentLevel.LevelNumber);
|
||||
AddChild(_sceneInstantiator.Instantiate(_levelScene,
|
||||
(IValueSetter<ILevel> levelSetter) => { levelSetter.Set(levelData); }));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user