WIP moving seed to plant matching into separate system, making fields independent of specific plants.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using Babushka.scripts.CSharp.Common.Inventory;
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
|
||||
namespace Babushka.scripts.CSharp.Common.Farming;
|
||||
|
||||
public partial class SeedRepository : Node
|
||||
{
|
||||
public static SeedRepository Instance { get; private set; } = null!;
|
||||
|
||||
// todo: Find out how to not use PackedScene here because it does not inherit from Node
|
||||
[Export] private Dictionary<ItemResource, PackedScene> seedToPlantRepository;
|
||||
|
||||
public override void _EnterTree()
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
public PackedScene? GetPlant(ItemResource resource)
|
||||
{
|
||||
if (seedToPlantRepository.ContainsKey(resource))
|
||||
{
|
||||
return seedToPlantRepository[resource];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user