droppable items and win

This commit is contained in:
Rendo 2025-07-20 22:11:23 +05:00
commit 0e8fe3b76d
47 changed files with 814 additions and 79 deletions

View file

@ -0,0 +1,34 @@
using Godot;
using Newlon;
using Newlon.Components;
using Newlon.Components.Plants;
public partial class RewardScene : Node
{
public override void _Ready()
{
var reward = LevelController.Instance.Reward;
var subviewport = GetNode<SubViewport>("%SubViewport");
var nameLabel = GetNode<Label>("%NameLabel");
var descriptionLabel = GetNode<RichTextLabel>("%DescriptionLabel");
var continueButton = GetNode<Button>("%ContinueButton");
var field = GetNode<Sprite2D>("%Field");
nameLabel.Text = Tr(reward.Name);
descriptionLabel.Text = Tr(reward.Description);
continueButton.Pressed += LevelController.Instance.ReturnToInitiator;
if (reward is PlantReward plantReward && plantReward.Plant.customFrame != null)
{
field.Texture = plantReward.Plant.customFrame.almanachField;
}
var rewardedObject = reward.GetPreview().Instantiate();
subviewport.AddChild(rewardedObject);
if (rewardedObject is Entity entity)
{
entity.DisableBrain();
}
}
}