droppable items and win
This commit is contained in:
parent
45f4fa32fa
commit
0e8fe3b76d
47 changed files with 814 additions and 79 deletions
34
scripts/gui/RewardScene.cs
Normal file
34
scripts/gui/RewardScene.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue