parent
ce2d7eb773
commit
7fd26ffed3
@ -1,11 +0,0 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://bqjx3luofm6yi"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://coqch6yjvjuc0" path="res://scripts/CSharp/Common/Farming/SeedRepository.cs" id="1_i7nvs"]
|
||||
[ext_resource type="Resource" uid="uid://d1uuxp1lp4aro" path="res://resources/items/tomato_seed.tres" id="2_jetk1"]
|
||||
[ext_resource type="PackedScene" uid="uid://gishbn0a8eke" path="res://prefabs/farm/tomato_plant.tscn" id="3_ulp3m"]
|
||||
|
||||
[node name="SeedRepository" type="Node2D"]
|
||||
script = ExtResource("1_i7nvs")
|
||||
seedToPlantRepository = Dictionary[Object, Node]({
|
||||
ExtResource("2_jetk1"): ExtResource("3_ulp3m")
|
||||
})
|
||||
@ -1,29 +0,0 @@
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
uid://coqch6yjvjuc0
|
||||
Loading…
Reference in new issue