Level/KeyPickUp.cs
using Opium;
[Obsolete( "Use InventoryItemPickup and make a item resource" )]
public struct DoorKey
{
[KeyProperty] public string Name { get; set; }
public string Description { get; set; }
[KeyProperty] public Color Color { get; set; }
public bool RemoveOnUse { get; set; }
public bool IsValid()
{
return !string.IsNullOrEmpty( Name );
}
}
[Obsolete( "Use InventoryItemPickup and make a item resource" )]
public sealed class KeyPickUp : BasePickup
{
[Property] public SoundEvent sound;
[Property] public DoorKey Key { get; set; }
public override void OnPickup( GameObject player )
{
if ( sound != null )
{
Sound.Play( sound, player.Transform.Position );
}
player.Components.Get<PlayerObjectivesUI>( FindMode.EnabledInSelfAndDescendants )?.ShowObjectiveUI();
base.OnPickup( player );
}
}