First commit for private source control. Older commits available on Github.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Framework.Managers.Levels.Data;
|
||||
using BriarQueen.Framework.Managers.Player.Data;
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace BriarQueen.Game.Puzzles.ChapterOne.Fountain
|
||||
{
|
||||
public class FountainGemSlot : BaseItem
|
||||
{
|
||||
private FountainGemBasePuzzle _puzzle;
|
||||
|
||||
private readonly string _firstPieceKey = ItemIDs.Get(ItemKey.Sapphire);
|
||||
private readonly string _secondPieceKey = ItemIDs.Get(ItemKey.Emerald);
|
||||
private readonly string _thirdPieceKey = ItemIDs.Get(ItemKey.Ruby);
|
||||
|
||||
public override string InteractableName => "Hole";
|
||||
|
||||
public void Initialize(FountainGemBasePuzzle puzzle)
|
||||
{
|
||||
_puzzle = puzzle;
|
||||
}
|
||||
|
||||
public override UniTask OnInteract(ItemDataSo item = null)
|
||||
{
|
||||
if (_puzzle == null || item == null || _puzzle.IsCompleted)
|
||||
{
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
if (!CheckEmptyHands())
|
||||
return UniTask.CompletedTask;
|
||||
|
||||
var itemID = item.UniqueID;
|
||||
if (!IsValidGem(itemID))
|
||||
{
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
_puzzle.TryInsertGem(item);
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
private bool IsValidGem(string itemID)
|
||||
{
|
||||
return itemID == _firstPieceKey ||
|
||||
itemID == _secondPieceKey ||
|
||||
itemID == _thirdPieceKey;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user