ChooseYourSeeds menu

This commit is contained in:
Фёдор Веселов 2024-09-22 20:37:00 +05:00
commit c9dd4cf175
23 changed files with 471 additions and 95 deletions

View file

@ -0,0 +1,28 @@
using Godot;
using System;
public partial class GridLoader : GridContainer
{
private const string PLANT_RESOURCE_PATH = "res://resources/plants/";
private PackedScene _plantCard;
public override void _Ready()
{
_plantCard = ResourceLoader.Load<PackedScene>("res://scenes/gui/seedpacket.tscn");
string[] files = DirAccess.GetFilesAt(PLANT_RESOURCE_PATH);
foreach(var file in files)
{
if(ResourceLoader.Exists(PLANT_RESOURCE_PATH+file))
{
Seedpacket slot = _plantCard.Instantiate<Seedpacket>();
AddChild(slot);
slot.SetPlantResource(ResourceLoader.Load<PlantResource>(PLANT_RESOURCE_PATH+file));
slot.SetHandler(new ChoosableHandler(slot));
}
}
}
}

View file

@ -0,0 +1,13 @@
using Godot;
public partial class LevelRunButton : Button
{
[Export] private AnimationPlayer _player;
public override void _Pressed()
{
RuntimeLevelData.Instance.SetLevelState(RuntimeLevelData.LevelStates.Game);
GetTree().Paused = false;
_player.Play("Hide");
}
}