First commit for private source control. Older commits available on Github.
This commit is contained in:
3
Assets/Scripts/Game/Items/Environment/ChapterOne.meta
Normal file
3
Assets/Scripts/Game/Items/Environment/ChapterOne.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: be01b5741bc94861a9b41d8c8ce3b5ee
|
||||
timeCreated: 1773590011
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ae64d437e6594bf58b5512ee5ffca402
|
||||
timeCreated: 1773590011
|
||||
@@ -0,0 +1,45 @@
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Data.IO.Saves;
|
||||
using BriarQueen.Framework.Events.UI;
|
||||
using BriarQueen.Framework.Managers.Levels.Data;
|
||||
using BriarQueen.Framework.Managers.Player.Data;
|
||||
using BriarQueen.Framework.Managers.UI;
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace BriarQueen.Game.Items.Environment.ChapterOne.Pumphouse
|
||||
{
|
||||
public class PumpHouseWaterValve : BaseItem
|
||||
{
|
||||
public override string InteractableName => "Water Valve";
|
||||
public override UICursorService.CursorStyle ApplicableCursorStyle => UICursorService.CursorStyle.Interact;
|
||||
|
||||
public override UniTask OnInteract(ItemDataSo item = null)
|
||||
{
|
||||
if (!CheckEmptyHands())
|
||||
return UniTask.CompletedTask;
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(ItemInteractKey.CantUseItem)));
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
if (SaveManager.GetLevelFlag(LevelFlag.PumpWaterRestored))
|
||||
{
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(LevelInteractKey.WaterValve)));
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
if (!SaveManager.GetLevelFlag(LevelFlag.FountainVinesCut))
|
||||
{
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(LevelInteractKey.ClearVinesOutside)));
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
// TODO : Play Water SFX
|
||||
SaveManager.SetLevelFlag(LevelFlag.PumpWaterRestored, true);
|
||||
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7ffe97b80fed45bbb7152752c4f10685
|
||||
timeCreated: 1770991451
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3825afbb1ee941b1af18781d8f1311fa
|
||||
timeCreated: 1773590034
|
||||
@@ -0,0 +1,44 @@
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Data.IO.Saves;
|
||||
using BriarQueen.Framework.Events.UI;
|
||||
using BriarQueen.Framework.Managers.Levels.Data;
|
||||
using BriarQueen.Framework.Managers.Player.Data;
|
||||
using BriarQueen.Framework.Managers.UI;
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace BriarQueen.Game.Items.Environment.ChapterOne.Village
|
||||
{
|
||||
public class ChainLock : BaseItem
|
||||
{
|
||||
public override string InteractableName => "Locked Chain";
|
||||
public override UICursorService.CursorStyle ApplicableCursorStyle => UICursorService.CursorStyle.Inspect;
|
||||
|
||||
public override async UniTask OnInteract(ItemDataSo item = null)
|
||||
{
|
||||
if (!CheckEmptyHands())
|
||||
return;
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(LevelInteractKey.PumphouseChain)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.UniqueID != ItemIDs.Pickups[ItemKey.PumphouseKey])
|
||||
{
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(ItemInteractKey.CantUseItem)));
|
||||
return;
|
||||
}
|
||||
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(LevelInteractKey.UnlockedPumphouse)));
|
||||
await Remove();
|
||||
}
|
||||
|
||||
protected override UniTask OnRemoved()
|
||||
{
|
||||
SaveManager.SetLevelFlag(LevelFlag.PumpHouseOpened, true);
|
||||
PlayerManager.RemoveItem(ItemIDs.Pickups[ItemKey.PumphouseKey]);
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bf2e55b12a3040deb4e54465336fc989
|
||||
timeCreated: 1770985414
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 45144a83888f401e8d282181328521fb
|
||||
timeCreated: 1773953887
|
||||
@@ -0,0 +1,56 @@
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Framework.Events.UI;
|
||||
using BriarQueen.Framework.Managers.Levels.Data;
|
||||
using BriarQueen.Framework.Managers.Player.Data;
|
||||
using BriarQueen.Framework.Managers.UI;
|
||||
using BriarQueen.Game.Levels.ChapterOne.VillageStreet;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BriarQueen.Game.Items.Environment.ChapterOne.VillageStreet
|
||||
{
|
||||
public class StreetVines : BaseItem
|
||||
{
|
||||
[SerializeField]
|
||||
private Street _owner;
|
||||
|
||||
public override UICursorService.CursorStyle ApplicableCursorStyle => UICursorService.CursorStyle.Inspect;
|
||||
|
||||
public override async UniTask OnInteract(ItemDataSo item = null)
|
||||
{
|
||||
if (_owner == null)
|
||||
{
|
||||
Debug.LogWarning("StreetVines is missing its Street owner.", this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CanUseKnife())
|
||||
{
|
||||
PublishFailureMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(
|
||||
InteractEventIDs.Get(EnvironmentInteractKey.UsingKnife)));
|
||||
|
||||
await _owner.CutVines();
|
||||
}
|
||||
|
||||
private bool CanUseKnife()
|
||||
{
|
||||
if (SettingsService.Game.AutoUseTools)
|
||||
return PlayerManager.HasAccessToTool(ToolID.Knife);
|
||||
|
||||
return PlayerManager.GetEquippedTool() == ToolID.Knife;
|
||||
}
|
||||
|
||||
private void PublishFailureMessage()
|
||||
{
|
||||
var message = SettingsService.Game.AutoUseTools
|
||||
? InteractEventIDs.Get(LevelInteractKey.CutVines)
|
||||
: InteractEventIDs.Get(ItemInteractKey.WrongTool);
|
||||
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(message));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 32a79fbd751c4216b83680bbc425cfa7
|
||||
timeCreated: 1773954077
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d5cf35e464ec407c81e5d29b6bf5c713
|
||||
timeCreated: 1773590078
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c3efb5408364c23bc9f0256bb727fb5
|
||||
timeCreated: 1773609093
|
||||
@@ -0,0 +1,20 @@
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Framework.Events.UI;
|
||||
using BriarQueen.Framework.Managers.Levels.Data;
|
||||
using BriarQueen.Framework.Managers.Player.Data;
|
||||
using BriarQueen.Framework.Managers.UI;
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace BriarQueen.Game.Items.Environment.ChapterOne.Workshop.Downstairs
|
||||
{
|
||||
public class WorkshopBrokenLantern : BaseItem
|
||||
{
|
||||
public override UICursorService.CursorStyle ApplicableCursorStyle => UICursorService.CursorStyle.Inspect;
|
||||
|
||||
public override UniTask OnInteract(ItemDataSo item = null)
|
||||
{
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(EnvironmentInteractKey.BrokenLantern)));
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1004a82a9b7f487180b0fcf4978a4446
|
||||
timeCreated: 1773609258
|
||||
@@ -0,0 +1,45 @@
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Framework.Events.UI;
|
||||
using BriarQueen.Framework.Managers.Levels.Data;
|
||||
using BriarQueen.Framework.Managers.Player.Data;
|
||||
using BriarQueen.Framework.Managers.UI;
|
||||
using BriarQueen.Game.Levels.ChapterOne.Workshop;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BriarQueen.Game.Items.Environment.ChapterOne.Workshop.Downstairs
|
||||
{
|
||||
public class WorkshopDownstairsLight : BaseItem
|
||||
{
|
||||
[SerializeField]
|
||||
private WorkshopDownstairs _workshopDownstairs;
|
||||
|
||||
public override UICursorService.CursorStyle ApplicableCursorStyle => UICursorService.CursorStyle.Interact;
|
||||
|
||||
public override string InteractableName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_workshopDownstairs.LightOn)
|
||||
return "Turn off Light";
|
||||
|
||||
return "Turn on Light";
|
||||
}
|
||||
}
|
||||
|
||||
public override UniTask OnInteract(ItemDataSo item = null)
|
||||
{
|
||||
if(!CheckEmptyHands())
|
||||
return UniTask.CompletedTask;
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(ItemInteractKey.CantUseItem)));
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
_workshopDownstairs.ToggleLightSwitch();
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5c5889af77b0491bb18818491222520b
|
||||
timeCreated: 1773609093
|
||||
@@ -0,0 +1,20 @@
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Framework.Events.UI;
|
||||
using BriarQueen.Framework.Managers.Levels.Data;
|
||||
using BriarQueen.Framework.Managers.Player.Data;
|
||||
using BriarQueen.Framework.Managers.UI;
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace BriarQueen.Game.Items.Environment.ChapterOne.Workshop.Downstairs
|
||||
{
|
||||
public class WorkshopWriting : BaseItem
|
||||
{
|
||||
public override UICursorService.CursorStyle ApplicableCursorStyle => UICursorService.CursorStyle.Inspect;
|
||||
|
||||
public override UniTask OnInteract(ItemDataSo item = null)
|
||||
{
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(EnvironmentInteractKey.WorkshopWriting)));
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f8ae950ec2f6412f9a05f9eb22a81004
|
||||
timeCreated: 1773681035
|
||||
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Data.IO.Saves;
|
||||
using BriarQueen.Framework.Events.Gameplay;
|
||||
using BriarQueen.Framework.Events.UI;
|
||||
using BriarQueen.Framework.Managers.Levels.Data;
|
||||
using BriarQueen.Framework.Managers.Player.Data;
|
||||
using BriarQueen.Framework.Managers.UI;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BriarQueen.Game.Items.Environment.ChapterOne.Workshop
|
||||
{
|
||||
public class GrindingStone : BaseItem
|
||||
{
|
||||
[SerializeField]
|
||||
private Levels.ChapterOne.Workshop.Workshop _workshop;
|
||||
|
||||
public override string InteractableName => "Grinding Stone";
|
||||
|
||||
public override UICursorService.CursorStyle ApplicableCursorStyle => UICursorService.CursorStyle.Interact;
|
||||
|
||||
public override async UniTask OnInteract(ItemDataSo item = null)
|
||||
{
|
||||
if (!CheckEmptyHands())
|
||||
return;
|
||||
|
||||
if (!SaveManager.GetLevelFlag(LevelFlag.WorkshopGrindstoneRepaired))
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
EventCoordinator.Publish(
|
||||
new DisplayInteractEvent(InteractEventIDs.Get(ItemInteractKey.SomethingMissing)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.UniqueID != ItemIDs.Get(ItemKey.GrindstoneAxlePin))
|
||||
{
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(ItemInteractKey.CantUseItem)));
|
||||
return;
|
||||
}
|
||||
|
||||
await _workshop.SetWoodenPin();
|
||||
return;
|
||||
}
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(EnvironmentInteractKey.UseGrindstone)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.UniqueID != ItemIDs.Get(ItemKey.RustedKnife))
|
||||
{
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(ItemInteractKey.CantUseItem)));
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO - Animations, SFX, etc
|
||||
|
||||
EventCoordinator.Publish(new FadeEvent(false, 0.6f));
|
||||
await UniTask.Delay(TimeSpan.FromSeconds(1.2f));
|
||||
AudioManager.Play(AudioNameIdentifiers.Get(SFXKey.SharpenKnife));
|
||||
EventCoordinator.Publish(new FadeEvent(true, 0.6f));
|
||||
await UniTask.Delay(TimeSpan.FromSeconds(0.8f));
|
||||
|
||||
PlayerManager.UnlockTool(ToolID.Knife);
|
||||
TutorialService.DisplayTutorial(TutorialPopupID.Tools);
|
||||
PlayerManager.RemoveItem(ItemIDs.Get(ItemKey.RustedKnife));
|
||||
|
||||
EventCoordinator.Publish(new SelectedItemChangedEvent(null));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7af3243d1b3240a5bb86ba7cd0b2e9b8
|
||||
timeCreated: 1771003747
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 09d6091451f64822a55575f3ab2b6b68
|
||||
timeCreated: 1773590204
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b57d4daa04964b28b6c24a1e41fb4d6a
|
||||
timeCreated: 1773590204
|
||||
@@ -0,0 +1,40 @@
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Framework.Events.UI;
|
||||
using BriarQueen.Framework.Managers.Levels.Data;
|
||||
using BriarQueen.Framework.Managers.Player.Data;
|
||||
using BriarQueen.Game.Levels.ChapterOne.Workshop.Upstairs;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BriarQueen.Game.Items.Environment.ChapterOne.Workshop.Upstairs.Bag
|
||||
{
|
||||
public class WorkshopBagBook : BaseItem
|
||||
{
|
||||
[Header("Internal")]
|
||||
[SerializeField]
|
||||
private WorkshopBag _bag;
|
||||
|
||||
public override string InteractableName => "Damaged Book";
|
||||
|
||||
public override async UniTask OnInteract(ItemDataSo item = null)
|
||||
{
|
||||
if(!CheckEmptyHands())
|
||||
return;
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(ItemInteractKey.CantUseItem)));
|
||||
return;
|
||||
}
|
||||
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(EnvironmentInteractKey.WorkshopBookDisintegrating)));
|
||||
await Remove();
|
||||
}
|
||||
|
||||
protected override UniTask OnRemoved()
|
||||
{
|
||||
_bag.RemoveBook();
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a482fd71d48d4edaaceec7a7038a72a2
|
||||
timeCreated: 1773496524
|
||||
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Data.IO.Saves;
|
||||
using BriarQueen.Framework.Events.UI;
|
||||
using BriarQueen.Framework.Managers.Levels.Data;
|
||||
using BriarQueen.Framework.Managers.Player.Data;
|
||||
using BriarQueen.Game.Levels.ChapterOne.Workshop.Upstairs;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BriarQueen.Game.Items.Environment.ChapterOne.Workshop.Upstairs.Bag
|
||||
{
|
||||
public class WorkshopBagHole : BaseItem
|
||||
{
|
||||
[Header("Workshop Bag")]
|
||||
[SerializeField]
|
||||
private WorkshopBag _workshopBag;
|
||||
|
||||
public override string InteractableName => "Dig";
|
||||
|
||||
public override async UniTask OnInteract(ItemDataSo item = null)
|
||||
{
|
||||
if(!CheckEmptyHands())
|
||||
return;
|
||||
|
||||
if (SaveManager.GetLevelFlag(LevelFlag.WorkshopBagHoleDug))
|
||||
{
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(
|
||||
InteractEventIDs.Get(EnvironmentInteractKey.WorkshopBagNoItems)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(ItemInteractKey.CantUseItem)));
|
||||
return;
|
||||
}
|
||||
|
||||
EventCoordinator.Publish(new FadeEvent(false, 1f));
|
||||
await UniTask.Delay(TimeSpan.FromSeconds(1));
|
||||
|
||||
await _workshopBag.DigHole();
|
||||
|
||||
await UniTask.Delay(TimeSpan.FromSeconds(1));
|
||||
EventCoordinator.Publish(new FadeEvent(true, 1f));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d8e8a954a6d04904b15e4e1b50db8615
|
||||
timeCreated: 1773494920
|
||||
3
Assets/Scripts/Game/Items/Environment/General.meta
Normal file
3
Assets/Scripts/Game/Items/Environment/General.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44d1ad2d59094966b83912a68097b451
|
||||
timeCreated: 1773590165
|
||||
3
Assets/Scripts/Game/Items/Environment/General/Book.meta
Normal file
3
Assets/Scripts/Game/Items/Environment/General/Book.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bb142f5c855c46e8a7e406646e5a7b02
|
||||
timeCreated: 1773507259
|
||||
@@ -0,0 +1,55 @@
|
||||
using BriarQueen.Framework.Coordinators.Events;
|
||||
using BriarQueen.Framework.Events.Input;
|
||||
using BriarQueen.Framework.Managers.Interaction;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using VContainer;
|
||||
|
||||
namespace BriarQueen.Game.Items.Environment.General.Book
|
||||
{
|
||||
public class BookInterface : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private CanvasGroup _canvasGroup;
|
||||
|
||||
[SerializeField]
|
||||
private GraphicRaycaster _graphicRaycaster;
|
||||
|
||||
private BookTrigger _bookTrigger;
|
||||
private EventCoordinator _eventCoordinator;
|
||||
private InteractManager _interactManager;
|
||||
|
||||
internal CanvasGroup CanvasGroup => _canvasGroup;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_interactManager.SetExclusiveRaycaster(_graphicRaycaster);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
_eventCoordinator.Unsubscribe<OnRightClickEvent>(OnRightClickPressed);
|
||||
_interactManager.ClearExclusiveRaycaster();
|
||||
}
|
||||
|
||||
[Inject]
|
||||
public void Construct(EventCoordinator eventCoordinator, InteractManager interactManager)
|
||||
{
|
||||
_eventCoordinator = eventCoordinator;
|
||||
_interactManager = interactManager;
|
||||
}
|
||||
|
||||
public void Initialise(BookTrigger trigger)
|
||||
{
|
||||
_bookTrigger = trigger;
|
||||
|
||||
_eventCoordinator.Subscribe<OnRightClickEvent>(OnRightClickPressed);
|
||||
}
|
||||
|
||||
private void OnRightClickPressed(OnRightClickEvent e)
|
||||
{
|
||||
_bookTrigger.CloseBookInterface().Forget();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a73c3f5588834da2a26a77de99f59e3c
|
||||
timeCreated: 1773508324
|
||||
@@ -0,0 +1,147 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Framework.Events.Save;
|
||||
using BriarQueen.Framework.Events.UI;
|
||||
using BriarQueen.Framework.Managers.Levels.Data;
|
||||
using BriarQueen.Framework.Managers.Player.Data;
|
||||
using BriarQueen.Framework.Managers.UI;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using PrimeTween;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BriarQueen.Game.Items.Environment.General.Book
|
||||
{
|
||||
public class BookTrigger : BaseItem
|
||||
{
|
||||
[Header("References")]
|
||||
[SerializeField]
|
||||
private AssetItemKey _bookAssetID;
|
||||
|
||||
[SerializeField]
|
||||
private BookEntryID _bookEntryID;
|
||||
|
||||
[Header("Book Interface")]
|
||||
[SerializeField]
|
||||
private BookInterface _bookInterface;
|
||||
|
||||
private CancellationTokenSource _displayCts;
|
||||
|
||||
private Sequence _displaySequence;
|
||||
|
||||
public override string InteractableName => "Worn Book";
|
||||
public override UICursorService.CursorStyle ApplicableCursorStyle => UICursorService.CursorStyle.Inspect;
|
||||
|
||||
public override async UniTask OnInteract(ItemDataSo item = null)
|
||||
{
|
||||
if (item != null)
|
||||
{
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(ItemInteractKey.CantUseItem)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CheckEmptyHands())
|
||||
return;
|
||||
|
||||
await InstantiateBookInterface();
|
||||
}
|
||||
|
||||
private async UniTask InstantiateBookInterface()
|
||||
{
|
||||
Debug.Log($"Instantiating {_bookAssetID}");
|
||||
|
||||
if (!AssetRegistry.TryGetReference(AssetKeyIdentifiers.Get(_bookAssetID), out var assetReference) ||
|
||||
assetReference == null)
|
||||
return;
|
||||
|
||||
var bookObj = await AddressableManager.InstantiateAsync(assetReference);
|
||||
if (bookObj == null) return;
|
||||
|
||||
_bookInterface = bookObj.GetComponent<BookInterface>();
|
||||
if (_bookInterface == null) return;
|
||||
|
||||
_bookInterface.CanvasGroup.alpha = 0f;
|
||||
_bookInterface.CanvasGroup.blocksRaycasts = false;
|
||||
_bookInterface.CanvasGroup.interactable = false;
|
||||
|
||||
_bookInterface.Initialise(this);
|
||||
Debug.Log($"Instantiated {_bookAssetID}");
|
||||
|
||||
CancelTweenIfRunning();
|
||||
_displayCts = new CancellationTokenSource();
|
||||
|
||||
_displaySequence = Sequence.Create(useUnscaledTime: true)
|
||||
.Group(Tween.Alpha(_bookInterface.CanvasGroup, new TweenSettings<float>
|
||||
{
|
||||
endValue = 1f,
|
||||
settings = new TweenSettings { duration = 0.8f }
|
||||
}));
|
||||
|
||||
try
|
||||
{
|
||||
await _displaySequence.ToUniTask(cancellationToken: _displayCts.Token);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
}
|
||||
|
||||
_bookInterface.CanvasGroup.blocksRaycasts = true;
|
||||
_bookInterface.CanvasGroup.interactable = true;
|
||||
|
||||
ShowTutorialIfNeeded();
|
||||
UnlockCodexEntry();
|
||||
}
|
||||
|
||||
private void ShowTutorialIfNeeded()
|
||||
{
|
||||
TutorialService.DisplayTutorial(TutorialPopupID.ExitItems);
|
||||
}
|
||||
|
||||
private void UnlockCodexEntry()
|
||||
{
|
||||
PlayerManager.UnlockCodexEntry(CodexEntryIDs.Get(_bookEntryID));
|
||||
}
|
||||
|
||||
public async UniTask CloseBookInterface()
|
||||
{
|
||||
if (_bookInterface == null) return;
|
||||
|
||||
CancelTweenIfRunning();
|
||||
_displayCts = new CancellationTokenSource();
|
||||
|
||||
_displaySequence = Sequence.Create(useUnscaledTime: true)
|
||||
.Group(Tween.Alpha(_bookInterface.CanvasGroup, new TweenSettings<float>
|
||||
{
|
||||
startValue = _bookInterface.CanvasGroup.alpha,
|
||||
endValue = 0f,
|
||||
settings = new TweenSettings { duration = 0.6f }
|
||||
}));
|
||||
|
||||
try
|
||||
{
|
||||
await _displaySequence.ToUniTask(cancellationToken: _displayCts.Token);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
}
|
||||
|
||||
await DestructionService.Destroy(_bookInterface.gameObject);
|
||||
_bookInterface = null;
|
||||
}
|
||||
|
||||
private void CancelTweenIfRunning()
|
||||
{
|
||||
if (_displaySequence.isAlive) _displaySequence.Complete();
|
||||
DisposeCts();
|
||||
}
|
||||
|
||||
private void DisposeCts()
|
||||
{
|
||||
if (_displayCts == null) return;
|
||||
|
||||
_displayCts.Cancel();
|
||||
_displayCts.Dispose();
|
||||
_displayCts = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ca523ca014894287805fea5daba9276c
|
||||
timeCreated: 1773507259
|
||||
@@ -0,0 +1,33 @@
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Framework.Events.UI;
|
||||
using BriarQueen.Framework.Managers.Levels.Data;
|
||||
using BriarQueen.Framework.Managers.Player.Data;
|
||||
using BriarQueen.Framework.Managers.UI;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BriarQueen.Game.Items.Environment.General
|
||||
{
|
||||
public class EnvironmentTrigger : BaseItem
|
||||
{
|
||||
[Header("Interaction")]
|
||||
[SerializeField]
|
||||
private EnvironmentInteractKey _interactKey;
|
||||
|
||||
[SerializeField]
|
||||
private bool _removeTrigger;
|
||||
|
||||
public override UICursorService.CursorStyle ApplicableCursorStyle => UICursorService.CursorStyle.Inspect;
|
||||
|
||||
public override async UniTask OnInteract(ItemDataSo item = null)
|
||||
{
|
||||
if (!CheckEmptyHands())
|
||||
return;
|
||||
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(_interactKey)));
|
||||
|
||||
if (_removeTrigger)
|
||||
await Remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f499bd83d87940e5892d63e525087505
|
||||
timeCreated: 1773862043
|
||||
@@ -0,0 +1,65 @@
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Data.IO.Saves;
|
||||
using BriarQueen.Framework.Events.UI;
|
||||
using BriarQueen.Framework.Managers.Levels.Data;
|
||||
using BriarQueen.Framework.Managers.Player.Data;
|
||||
using BriarQueen.Framework.Managers.UI;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BriarQueen.Game.Items.Environment.General
|
||||
{
|
||||
public class TwistingVines : BaseItem
|
||||
{
|
||||
[Header("Flags")]
|
||||
[SerializeField]
|
||||
private LevelFlag _levelFlag;
|
||||
|
||||
public override string InteractableName => "Twisting Vines";
|
||||
public override UICursorService.CursorStyle ApplicableCursorStyle => UICursorService.CursorStyle.Inspect;
|
||||
|
||||
public override async UniTask OnInteract(ItemDataSo item = null)
|
||||
{
|
||||
if (item != null)
|
||||
{
|
||||
EventCoordinator.Publish(
|
||||
new DisplayInteractEvent(InteractEventIDs.Get(ItemInteractKey.CantUseItem)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CanUseKnife())
|
||||
{
|
||||
PublishFailureMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
EventCoordinator.Publish(
|
||||
new DisplayInteractEvent(InteractEventIDs.Get(EnvironmentInteractKey.UsingKnife)));
|
||||
|
||||
await Remove();
|
||||
}
|
||||
|
||||
protected override UniTask OnRemoved()
|
||||
{
|
||||
SaveManager.SetLevelFlag(_levelFlag, true);
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
private bool CanUseKnife()
|
||||
{
|
||||
if (SettingsService.Game.AutoUseTools)
|
||||
return PlayerManager.HasAccessToTool(ToolID.Knife);
|
||||
|
||||
return PlayerManager.GetEquippedTool() == ToolID.Knife;
|
||||
}
|
||||
|
||||
private void PublishFailureMessage()
|
||||
{
|
||||
var message = SettingsService.Game.AutoUseTools
|
||||
? InteractEventIDs.Get(LevelInteractKey.CutVines)
|
||||
: InteractEventIDs.Get(ItemInteractKey.WrongTool);
|
||||
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(message));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 716b29e16fd1452b87eaf8903c0275a0
|
||||
timeCreated: 1770982267
|
||||
Reference in New Issue
Block a user