ChooseYourSeeds menu
This commit is contained in:
parent
91d85199a7
commit
c9dd4cf175
23 changed files with 471 additions and 95 deletions
28
scripts/components/gui/choose_your_seeds/GridLoader.cs
Normal file
28
scripts/components/gui/choose_your_seeds/GridLoader.cs
Normal 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));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
13
scripts/components/gui/choose_your_seeds/LevelRunButton.cs
Normal file
13
scripts/components/gui/choose_your_seeds/LevelRunButton.cs
Normal 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");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue