Add new components: CannotStompComponent, SkillUnlockedComponent, SpaceshipEnterComponent, SpaceshipExitComponent, SpinComponent, StompDamageComponent, StraightMotionComponent, TerrainHitFx, TooltipComponent, TrailComponent, and UnlockOnRequirementComponent
This commit is contained in:
25
scripts/components/UnlockOnRequirementComponent.cs
Normal file
25
scripts/components/UnlockOnRequirementComponent.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Godot;
|
||||
using Mr.BrickAdventures.scripts.interfaces;
|
||||
using Mr.BrickAdventures.scripts.Resources;
|
||||
|
||||
namespace Mr.BrickAdventures.scripts.components;
|
||||
|
||||
public partial class UnlockOnRequirementComponent : Node
|
||||
{
|
||||
[Export] public RequirementComponent RequirementComponent { get; set; }
|
||||
[Export] public Node UnlockTarget { get; set; }
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
RequirementComponent.RequirementMet += OnRequirementMet;
|
||||
}
|
||||
|
||||
private void OnRequirementMet(CollectableType requirementType)
|
||||
{
|
||||
if (requirementType != RequirementComponent.RequirementType) return;
|
||||
if (UnlockTarget is IUnlockable unlockable)
|
||||
{
|
||||
unlockable.Unlock();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user