First commit for private source control. Older commits available on Github.
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6b619d489d9440a0a3c1a9f46eda7fe6
|
||||
timeCreated: 1773780379
|
||||
@@ -0,0 +1,97 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Framework.Coordinators.Events;
|
||||
using BriarQueen.Framework.Events.Gameplay;
|
||||
using BriarQueen.Framework.Events.UI;
|
||||
using BriarQueen.Framework.Managers.Interaction.Data;
|
||||
using BriarQueen.Framework.Managers.Player;
|
||||
using BriarQueen.Framework.Managers.Player.Data;
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace BriarQueen.Game.Items.Interactions.ChapterOne.Village
|
||||
{
|
||||
[Serializable]
|
||||
public class PliersInteraction : BaseInteraction
|
||||
{
|
||||
public override UniTask<bool> TryUseWith(
|
||||
ItemDataSo self,
|
||||
ItemDataSo other,
|
||||
PlayerManager playerManager,
|
||||
EventCoordinator eventCoordinator)
|
||||
{
|
||||
if (other == null)
|
||||
{
|
||||
eventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(ItemInteractKey.CantUseItem)));
|
||||
return UniTask.FromResult(false);
|
||||
}
|
||||
|
||||
var pliersId = ItemIDs.Get(ItemKey.Pliers);
|
||||
|
||||
var emeraldAmuletId = ItemIDs.Get(ItemKey.EmeraldAmulet);
|
||||
var rubyRingId = ItemIDs.Get(ItemKey.RubyRing);
|
||||
var diamondTiaraId = ItemIDs.Get(ItemKey.DiamondTiara);
|
||||
|
||||
var emeraldId = ItemIDs.Get(ItemKey.Emerald);
|
||||
var rubyId = ItemIDs.Get(ItemKey.Ruby);
|
||||
var diamondId = ItemIDs.Get(ItemKey.Diamond);
|
||||
|
||||
var success = other.UniqueID switch
|
||||
{
|
||||
var id when id == emeraldAmuletId => ExtractGem(
|
||||
emeraldId,
|
||||
emeraldAmuletId,
|
||||
"You carefully pull the emerald out of the amulet."),
|
||||
|
||||
var id when id == rubyRingId => ExtractGem(
|
||||
rubyId,
|
||||
rubyRingId,
|
||||
"You carefully pull the ruby out of the ring."),
|
||||
|
||||
var id when id == diamondTiaraId => ExtractGem(
|
||||
diamondId,
|
||||
diamondTiaraId,
|
||||
"You carefully pull the diamond out of the tiara."),
|
||||
|
||||
_ => FailInteraction()
|
||||
};
|
||||
|
||||
return UniTask.FromResult(success);
|
||||
|
||||
bool ExtractGem(string gemId, string sourceItemId, string message)
|
||||
{
|
||||
eventCoordinator.Publish(new DisplayInteractEvent(message));
|
||||
playerManager.CollectItem(gemId);
|
||||
playerManager.RemoveItem(sourceItemId);
|
||||
|
||||
eventCoordinator.Publish(new SelectedItemChangedEvent(null));
|
||||
|
||||
CheckIfPliersBreak();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FailInteraction()
|
||||
{
|
||||
eventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(ItemInteractKey.CantUseItem)));
|
||||
return false;
|
||||
}
|
||||
|
||||
void CheckIfPliersBreak()
|
||||
{
|
||||
var collectedItems = playerManager.GetAllCollectedItems();
|
||||
|
||||
var hasEmerald = collectedItems.Any(x => x.UniqueID == emeraldId);
|
||||
var hasRuby = collectedItems.Any(x => x.UniqueID == rubyId);
|
||||
var hasDiamond = collectedItems.Any(x => x.UniqueID == diamondId);
|
||||
|
||||
if (hasEmerald && hasRuby && hasDiamond)
|
||||
{
|
||||
eventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(ItemInteractKey.PliersSnapped)));
|
||||
playerManager.RemoveItem(pliersId);
|
||||
|
||||
eventCoordinator.Publish(new SelectedItemChangedEvent(null));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b067daed4e5f4296a1a77f92af07cbc1
|
||||
timeCreated: 1773780295
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0adff31d53cb4f0197b3bfd4b779d036
|
||||
timeCreated: 1771172785
|
||||
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Framework.Coordinators.Events;
|
||||
using BriarQueen.Framework.Events.Gameplay;
|
||||
using BriarQueen.Framework.Events.UI;
|
||||
using BriarQueen.Framework.Managers.Interaction.Data;
|
||||
using BriarQueen.Framework.Managers.Player;
|
||||
using BriarQueen.Framework.Managers.Player.Data;
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace BriarQueen.Game.Items.Interactions.ChapterOne.Workshop
|
||||
{
|
||||
[Serializable]
|
||||
public class SmallRagInteraction : BaseInteraction
|
||||
{
|
||||
public override async UniTask<bool> TryUseWith(ItemDataSo self, ItemDataSo other, PlayerManager playerManager,
|
||||
EventCoordinator eventCoordinator)
|
||||
{
|
||||
if (other == null)
|
||||
return false;
|
||||
|
||||
if (other.UniqueID != ItemIDs.Get(ItemKey.DustySapphire))
|
||||
return false;
|
||||
|
||||
eventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(ItemInteractKey.LooksImportant)));
|
||||
playerManager.CollectItem(ItemIDs.Get(ItemKey.Sapphire));
|
||||
playerManager.RemoveItem(ItemIDs.Get(ItemKey.DustySapphire));
|
||||
playerManager.RemoveItem(ItemIDs.Get(ItemKey.SmallRag));
|
||||
|
||||
eventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(ItemInteractKey.RagFallsApart)));
|
||||
eventCoordinator.Publish(new SelectedItemChangedEvent(null));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e41ece1b6efd4de3ae4a7c5fa0cf7a8a
|
||||
timeCreated: 1771172802
|
||||
Reference in New Issue
Block a user