First commit for private source control. Older commits available on Github.
This commit is contained in:
3
Assets/Scripts/Game/Levels/ChapterOne.meta
Normal file
3
Assets/Scripts/Game/Levels/ChapterOne.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b9b1b36bb3e74a68beb66483b88a7dd7
|
||||
timeCreated: 1770058841
|
||||
3
Assets/Scripts/Game/Levels/ChapterOne/PumpingHouse.meta
Normal file
3
Assets/Scripts/Game/Levels/ChapterOne/PumpingHouse.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0114dbf070ab429b8a99aed3853b3601
|
||||
timeCreated: 1773606763
|
||||
@@ -0,0 +1,23 @@
|
||||
using System.Linq;
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Framework.Managers.Levels.Data;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BriarQueen.Game.Levels.ChapterOne.PumpingHouse
|
||||
{
|
||||
public class Pumphouse : BaseLevel
|
||||
{
|
||||
[SerializeField]
|
||||
private GameObject _pliers;
|
||||
|
||||
public override string LevelName => "Pumphouse";
|
||||
|
||||
protected override async UniTask PostLoadInternal()
|
||||
{
|
||||
if (SaveManager.CurrentSave.CollectedItems.Any(x => x.UniqueIdentifier == ItemIDs.Get(ItemKey.Pliers)))
|
||||
await DestructionService.Destroy(_pliers);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1efd43218bd3433ba49703e12a719efd
|
||||
timeCreated: 1773606763
|
||||
@@ -0,0 +1,20 @@
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Framework.Events.Save;
|
||||
using BriarQueen.Framework.Events.UI;
|
||||
using BriarQueen.Framework.Managers.Levels.Data;
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace BriarQueen.Game.Levels.ChapterOne.PumpingHouse
|
||||
{
|
||||
public class PumphouseTable : BaseLevel
|
||||
{
|
||||
public override string LevelName => "Pumphouse Table";
|
||||
|
||||
protected override UniTask PostActivateInternal()
|
||||
{
|
||||
TutorialService.DisplayTutorial(TutorialPopupID.HiddenItems);
|
||||
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c2b71bfe7974dad82e7256cca1c93d2
|
||||
timeCreated: 1773851681
|
||||
3
Assets/Scripts/Game/Levels/ChapterOne/Village.meta
Normal file
3
Assets/Scripts/Game/Levels/ChapterOne/Village.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9c46a25f88fe433d914b9615659244a5
|
||||
timeCreated: 1772743315
|
||||
61
Assets/Scripts/Game/Levels/ChapterOne/Village/Village.cs
Normal file
61
Assets/Scripts/Game/Levels/ChapterOne/Village/Village.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Data.IO.Saves;
|
||||
using BriarQueen.Framework.Managers.Hints.Data;
|
||||
using BriarQueen.Framework.Managers.Levels.Data;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace BriarQueen.Game.Levels.ChapterOne.Village
|
||||
{
|
||||
public class Village : BaseLevel
|
||||
{
|
||||
[Header("Level Setup")]
|
||||
[SerializeField]
|
||||
private Image _background;
|
||||
|
||||
[SerializeField]
|
||||
private Sprite _waterFlowingSprite;
|
||||
|
||||
[Header("Items")]
|
||||
[SerializeField]
|
||||
private BaseItem _chainAndLock;
|
||||
|
||||
[SerializeField]
|
||||
private BaseItem _vines;
|
||||
|
||||
public override string LevelName => "Village";
|
||||
public override bool IsPuzzleLevel => false;
|
||||
public override int CurrentLevelHintStage { get; set; }
|
||||
public override Dictionary<int, BaseHint> Hints { get; }
|
||||
|
||||
protected override async UniTask PostLoadInternal()
|
||||
{
|
||||
Debug.Log("[Village] Post Load Internal");
|
||||
Debug.Log($"[Village] Post Load Internal - Pumphouse Open - {SaveManager.GetLevelFlag(LevelFlag.PumpHouseOpened)}");
|
||||
|
||||
if (SaveManager.GetLevelFlag(LevelFlag.PumpHouseOpened))
|
||||
{
|
||||
if (_chainAndLock != null)
|
||||
await DestructionService.Destroy(_chainAndLock.gameObject);
|
||||
}
|
||||
|
||||
if (SaveManager.GetLevelFlag(LevelFlag.FountainVinesCut))
|
||||
{
|
||||
if (_vines != null)
|
||||
await DestructionService.Destroy(_vines.gameObject);
|
||||
}
|
||||
|
||||
if (SaveManager.GetLevelFlag(LevelFlag.PumpWaterRestored))
|
||||
_background.sprite = _waterFlowingSprite;
|
||||
}
|
||||
|
||||
protected override UniTask PostActivateInternal()
|
||||
{
|
||||
TutorialService.DisplayTutorial(TutorialPopupID.ReturnToPreviousLevel);
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1dfea341be6947e8baa194eb4472e18f
|
||||
timeCreated: 1770979966
|
||||
15
Assets/Scripts/Game/Levels/ChapterOne/Village/VillageEdge.cs
Normal file
15
Assets/Scripts/Game/Levels/ChapterOne/Village/VillageEdge.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Framework.Managers.Hints.Data;
|
||||
using BriarQueen.Framework.Managers.Levels.Data;
|
||||
|
||||
namespace BriarQueen.Game.Levels.ChapterOne.Village
|
||||
{
|
||||
public class VillageEdge : BaseLevel
|
||||
{
|
||||
public override string LevelName => "Edge of a Village";
|
||||
public override bool IsPuzzleLevel => false;
|
||||
public override int CurrentLevelHintStage { get; set; }
|
||||
public override Dictionary<int, BaseHint> Hints { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 540e8f4ac4d941d2a80c6b1b92c5cac9
|
||||
timeCreated: 1770833366
|
||||
3
Assets/Scripts/Game/Levels/ChapterOne/VillageStreet.meta
Normal file
3
Assets/Scripts/Game/Levels/ChapterOne/VillageStreet.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f4b44caa9d2541afa6e53cc5c2f5de82
|
||||
timeCreated: 1773952163
|
||||
@@ -0,0 +1,99 @@
|
||||
using System;
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Data.IO.Saves;
|
||||
using BriarQueen.Framework.Events.UI;
|
||||
using BriarQueen.Framework.Managers.Levels.Data;
|
||||
using BriarQueen.Game.Items.Environment.ChapterOne.VillageStreet;
|
||||
using BriarQueen.Game.Items.HoverZones;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace BriarQueen.Game.Levels.ChapterOne.VillageStreet
|
||||
{
|
||||
public class Street : BaseLevel
|
||||
{
|
||||
[Header("Level Setup")]
|
||||
[SerializeField]
|
||||
private Image _background;
|
||||
|
||||
[SerializeField]
|
||||
private Sprite _vinesCutSprite;
|
||||
|
||||
[SerializeField]
|
||||
private Sprite _gateOpenSprite;
|
||||
|
||||
[Header("Zones")]
|
||||
[SerializeField]
|
||||
private StreetVines _vinesZone;
|
||||
[SerializeField]
|
||||
private InteractZone _plaqueZone;
|
||||
|
||||
[SerializeField]
|
||||
private InteractZone _gateZone;
|
||||
|
||||
|
||||
protected override UniTask PostLoadInternal()
|
||||
{
|
||||
bool gateOpen = SaveManager.GetLevelFlag(LevelFlag.StreetGateOpen);
|
||||
bool vinesCut = SaveManager.GetLevelFlag(LevelFlag.StreetVinesCut) || gateOpen;
|
||||
|
||||
if (gateOpen)
|
||||
{
|
||||
_background.sprite = _gateOpenSprite;
|
||||
}
|
||||
else if (vinesCut)
|
||||
{
|
||||
_background.sprite = _vinesCutSprite;
|
||||
}
|
||||
|
||||
ApplyZones(vinesCut, gateOpen);
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
public async UniTask CutVines()
|
||||
{
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(EnvironmentInteractKey.UsingKnife)));
|
||||
await UniTask.Delay(TimeSpan.FromSeconds(1));
|
||||
EventCoordinator.Publish(new FadeEvent(false, 0.8f));
|
||||
await UniTask.Delay(TimeSpan.FromSeconds(0.8f));
|
||||
|
||||
_background.sprite = _vinesCutSprite;
|
||||
SetZoneState(_plaqueZone, true);
|
||||
|
||||
SaveManager.SetLevelFlag(LevelFlag.StreetVinesCut, true);
|
||||
EventCoordinator.Publish(new FadeEvent(true, 0.8f));
|
||||
}
|
||||
|
||||
private void ApplyZones(bool vinesCut, bool gateOpen)
|
||||
{
|
||||
SetZoneState(_plaqueZone, vinesCut);
|
||||
SetZoneState(_gateZone, gateOpen);
|
||||
|
||||
if(vinesCut)
|
||||
DeactivateVines();
|
||||
}
|
||||
|
||||
private void SetZoneState(InteractZone zone, bool active)
|
||||
{
|
||||
if (zone == null || zone.CanvasGroup == null)
|
||||
return;
|
||||
|
||||
zone.CanvasGroup.alpha = active ? 1 : 0;
|
||||
zone.CanvasGroup.blocksRaycasts = active;
|
||||
zone.CanvasGroup.interactable = active;
|
||||
}
|
||||
|
||||
private void DeactivateVines()
|
||||
{
|
||||
var canvasGroup = _vinesZone.CanvasGroup;
|
||||
|
||||
if (!canvasGroup)
|
||||
return;
|
||||
|
||||
canvasGroup.alpha = 0;
|
||||
canvasGroup.blocksRaycasts = false;
|
||||
canvasGroup.interactable = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 48395629807046b69b42b1cf8f8ffb75
|
||||
timeCreated: 1773952163
|
||||
3
Assets/Scripts/Game/Levels/ChapterOne/Workshop.meta
Normal file
3
Assets/Scripts/Game/Levels/ChapterOne/Workshop.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 747b05f0c81d45fa939de8efa637bb8f
|
||||
timeCreated: 1772743307
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fab32c0344e04eda879304b661495e65
|
||||
timeCreated: 1773421109
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 39fa1451796d4a398046bf1c12c31a3a
|
||||
timeCreated: 1773421126
|
||||
@@ -0,0 +1,26 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace BriarQueen.Game.Levels.ChapterOne.Workshop.Upstairs.Components
|
||||
{
|
||||
public class CandleImage : MonoBehaviour
|
||||
{
|
||||
public CanvasGroup CanvasGroup;
|
||||
public Image Image;
|
||||
public int Slot;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
CanvasGroup = GetComponent<CanvasGroup>();
|
||||
}
|
||||
|
||||
public void EmptyImage()
|
||||
{
|
||||
if (Image != null)
|
||||
Image.sprite = null;
|
||||
|
||||
if (CanvasGroup != null)
|
||||
CanvasGroup.alpha = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fa3541e6d37e44729fa46753d10d1cf9
|
||||
timeCreated: 1772818740
|
||||
@@ -0,0 +1,90 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Data.IO.Saves;
|
||||
using BriarQueen.Framework.Events.UI;
|
||||
using BriarQueen.Framework.Managers.Levels.Data;
|
||||
using BriarQueen.Game.Items.Environment.ChapterOne.Workshop.Upstairs.Bag;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace BriarQueen.Game.Levels.ChapterOne.Workshop.Upstairs
|
||||
{
|
||||
public class WorkshopBag : BaseLevel
|
||||
{
|
||||
[Header("Backgrounds")]
|
||||
[SerializeField]
|
||||
private Image _startBackground;
|
||||
|
||||
[SerializeField]
|
||||
private Image _holeBackground;
|
||||
|
||||
[Header("Items")]
|
||||
[SerializeField]
|
||||
private List<BaseItem> _holeItems;
|
||||
|
||||
[SerializeField]
|
||||
private WorkshopBagBook _book;
|
||||
|
||||
[SerializeField]
|
||||
private WorkshopBagHole _hole;
|
||||
|
||||
public override string LevelName => "Open Bag";
|
||||
|
||||
protected override UniTask PostLoadInternal()
|
||||
{
|
||||
CheckBackgrounds();
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
public void RemoveBook()
|
||||
{
|
||||
_hole.CanvasGroup.interactable = true;
|
||||
_hole.CanvasGroup.blocksRaycasts = true;
|
||||
}
|
||||
|
||||
public UniTask DigHole()
|
||||
{
|
||||
SaveManager.SetLevelFlag(LevelFlag.WorkshopBagHoleDug, true);
|
||||
|
||||
_startBackground.enabled = false;
|
||||
_holeBackground.enabled = true;
|
||||
|
||||
_hole.CanvasGroup.interactable = false;
|
||||
_hole.CanvasGroup.blocksRaycasts = false;
|
||||
_hole.CanvasGroup.alpha = 0;
|
||||
|
||||
DisplayMessage();
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
private void DisplayMessage()
|
||||
{
|
||||
EventCoordinator.Publish(new DisplayInteractEvent(InteractEventIDs.Get(EnvironmentInteractKey.WorkshopBagNoItems)));
|
||||
}
|
||||
|
||||
private void CheckBackgrounds()
|
||||
{
|
||||
if (SaveManager.GetLevelFlag(LevelFlag.WorkshopBagHoleDug))
|
||||
{
|
||||
_startBackground.enabled = false;
|
||||
_holeBackground.enabled = true;
|
||||
|
||||
DisplayMessage();
|
||||
}
|
||||
else
|
||||
{
|
||||
_startBackground.enabled = true;
|
||||
_holeBackground.enabled = false;
|
||||
|
||||
if (SaveManager.CurrentSave.RemovedItems.Any(x => x.UniqueIdentifier == _book.ItemData.UniqueID))
|
||||
{
|
||||
_hole.CanvasGroup.interactable = true;
|
||||
_hole.CanvasGroup.blocksRaycasts = true;
|
||||
_hole.CanvasGroup.alpha = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f577c40b25aa41c5a55fefb79cb2ae0d
|
||||
timeCreated: 1773495143
|
||||
@@ -0,0 +1,11 @@
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Framework.Managers.Levels.Data;
|
||||
|
||||
namespace BriarQueen.Game.Levels.ChapterOne.Workshop.Upstairs
|
||||
{
|
||||
public class WorkshopPuzzleBoxOpen : BaseLevel
|
||||
{
|
||||
|
||||
public override string LevelName => "Open Jewellery Box";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 69089c335b6a48738ae84a881b91abcf
|
||||
timeCreated: 1773599886
|
||||
@@ -0,0 +1,11 @@
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Framework.Managers.Levels.Data;
|
||||
|
||||
namespace BriarQueen.Game.Levels.ChapterOne.Workshop.Upstairs
|
||||
{
|
||||
public class WorkshopSafe : BaseLevel
|
||||
{
|
||||
|
||||
public override string LevelName => "Inspect Safe";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 728525259c524516b4aa00a20b5577bb
|
||||
timeCreated: 1773605635
|
||||
@@ -0,0 +1,112 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AYellowpaper.SerializedCollections;
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Framework.Events.Save;
|
||||
using BriarQueen.Framework.Events.UI;
|
||||
using BriarQueen.Framework.Managers.Hints.Data;
|
||||
using BriarQueen.Framework.Managers.Levels.Data;
|
||||
using BriarQueen.Game.Items.Pickups.ChapterOne.Workshop;
|
||||
using BriarQueen.Game.Levels.ChapterOne.Workshop.Upstairs.Components;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BriarQueen.Game.Levels.ChapterOne.Workshop.Upstairs
|
||||
{
|
||||
public class WorkshopUpstairs : BaseLevel
|
||||
{
|
||||
private static readonly Dictionary<string, Candle.CandleColour> CandleIDToColour = new()
|
||||
{
|
||||
{ ItemIDs.Pickups[ItemKey.RedCandle], Candle.CandleColour.Red },
|
||||
{ ItemIDs.Pickups[ItemKey.OrangeCandle], Candle.CandleColour.Orange },
|
||||
{ ItemIDs.Pickups[ItemKey.YellowCandle], Candle.CandleColour.Yellow },
|
||||
{ ItemIDs.Pickups[ItemKey.GreenCandle], Candle.CandleColour.Green },
|
||||
{ ItemIDs.Pickups[ItemKey.BlueCandle], Candle.CandleColour.Blue },
|
||||
{ ItemIDs.Pickups[ItemKey.IndigoCandle], Candle.CandleColour.Indigo },
|
||||
{ ItemIDs.Pickups[ItemKey.VioletCandle], Candle.CandleColour.Violet }
|
||||
};
|
||||
|
||||
[Header("Sprites")]
|
||||
[SerializedDictionary("Candle Colour", "Sprite")]
|
||||
[SerializeField]
|
||||
private SerializedDictionary<Candle.CandleColour, Sprite> _candleSprites = new();
|
||||
|
||||
[Header("Variables")]
|
||||
[SerializeField]
|
||||
private List<CandleImage> _candles = new();
|
||||
|
||||
|
||||
public override string LevelName => "Workshop Bedroom";
|
||||
|
||||
public override bool IsPuzzleLevel => false;
|
||||
public override int CurrentLevelHintStage { get; set; }
|
||||
public override Dictionary<int, BaseHint> Hints { get; } = new();
|
||||
|
||||
|
||||
protected override UniTask PostLoadInternal()
|
||||
{
|
||||
HandleCandles();
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
protected override async UniTask PostActivateInternal()
|
||||
{
|
||||
await HandleTutorial();
|
||||
}
|
||||
|
||||
private async UniTask HandleTutorial()
|
||||
{
|
||||
TutorialService.DisplayTutorial(TutorialPopupID.HideHUD);
|
||||
}
|
||||
|
||||
private void HandleCandles()
|
||||
{
|
||||
foreach (var candleImage in _candles)
|
||||
{
|
||||
if (candleImage == null) continue;
|
||||
candleImage.EmptyImage();
|
||||
}
|
||||
|
||||
var persistentVariables = SaveManager.CurrentSave?.PersistentVariables;
|
||||
var chapterOne = persistentVariables?.Game;
|
||||
var slots = chapterOne?.WorkshopCandleSlotsFilled;
|
||||
|
||||
if (slots == null || slots.Count == 0)
|
||||
return;
|
||||
|
||||
var candleBySlot = _candles
|
||||
.Where(c => c != null)
|
||||
.GroupBy(c => c.Slot)
|
||||
.ToDictionary(g => g.Key, g => g.First());
|
||||
|
||||
foreach (var kvp in slots)
|
||||
{
|
||||
if (!candleBySlot.TryGetValue(kvp.Key, out var slotImage) || slotImage == null)
|
||||
continue;
|
||||
|
||||
var sprite = GetCandleSprite(kvp.Value);
|
||||
|
||||
if (sprite == null)
|
||||
continue;
|
||||
|
||||
Debug.Log($"[Workshop Upstairs] Setting Slot {kvp.Key} to {sprite.name}");
|
||||
|
||||
slotImage.Image.sprite = sprite;
|
||||
slotImage.CanvasGroup.alpha = 1;
|
||||
}
|
||||
}
|
||||
|
||||
private Sprite GetCandleSprite(string candleID)
|
||||
{
|
||||
if (CandleIDToColour.TryGetValue(candleID, out var colour))
|
||||
return GetCandleSprite(colour);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Sprite GetCandleSprite(Candle.CandleColour colour)
|
||||
{
|
||||
return _candleSprites != null && _candleSprites.TryGetValue(colour, out var sprite) ? sprite : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7f7de1d8bdd94d7191aa51b92f48623e
|
||||
timeCreated: 1772743333
|
||||
55
Assets/Scripts/Game/Levels/ChapterOne/Workshop/Workshop.cs
Normal file
55
Assets/Scripts/Game/Levels/ChapterOne/Workshop/Workshop.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Data.IO.Saves;
|
||||
using BriarQueen.Framework.Events.UI;
|
||||
using BriarQueen.Framework.Managers.Hints.Data;
|
||||
using BriarQueen.Framework.Managers.Levels.Data;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace BriarQueen.Game.Levels.ChapterOne.Workshop
|
||||
{
|
||||
public class Workshop : BaseLevel
|
||||
{
|
||||
[Header("Level")]
|
||||
[SerializeField]
|
||||
private Image _backgroundImage;
|
||||
|
||||
[Header("Variables")]
|
||||
[SerializeField]
|
||||
private Sprite _doorOpenSprite;
|
||||
|
||||
[SerializeField]
|
||||
private Sprite _grindstoneRepairedSprite;
|
||||
|
||||
public override string LevelName => "Abandoned Workshop";
|
||||
public override bool IsPuzzleLevel => false;
|
||||
public override int CurrentLevelHintStage { get; set; }
|
||||
public override Dictionary<int, BaseHint> Hints { get; }
|
||||
|
||||
protected override UniTask PostLoadInternal()
|
||||
{
|
||||
if (SaveManager.GetLevelFlag(LevelFlag.WorkshopGrindstoneRepaired))
|
||||
_backgroundImage.sprite = _grindstoneRepairedSprite;
|
||||
else if (SaveManager.GetLevelFlag(LevelFlag.WorkshopDownstairsDoorOpen))
|
||||
_backgroundImage.sprite = _doorOpenSprite;
|
||||
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
public async UniTask SetWoodenPin()
|
||||
{
|
||||
EventCoordinator.Publish(new FadeEvent(false, 1f));
|
||||
await UniTask.Delay(TimeSpan.FromSeconds(1));
|
||||
|
||||
_backgroundImage.sprite = _grindstoneRepairedSprite;
|
||||
|
||||
PlayerManager.RemoveItem(ItemIDs.Pickups[ItemKey.GrindstoneAxlePin]);
|
||||
SaveManager.SetLevelFlag(LevelFlag.WorkshopGrindstoneRepaired, true);
|
||||
|
||||
EventCoordinator.Publish(new FadeEvent(true, 1f));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 775883e2fe824bc8a5d296d47658c056
|
||||
timeCreated: 1771012453
|
||||
@@ -0,0 +1,80 @@
|
||||
using System.Collections.Generic;
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Data.IO.Saves;
|
||||
using BriarQueen.Framework.Managers.Levels.Data;
|
||||
using BriarQueen.Game.Items.HoverZones;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace BriarQueen.Game.Levels.ChapterOne.Workshop
|
||||
{
|
||||
public class WorkshopDownstairs : BaseLevel
|
||||
{
|
||||
[Header("Specific Setup")]
|
||||
[SerializeField]
|
||||
private Image _background;
|
||||
|
||||
[SerializeField]
|
||||
private Sprite _lightOffSprite;
|
||||
|
||||
[SerializeField]
|
||||
private Sprite _lightOnSprite;
|
||||
|
||||
[SerializeField]
|
||||
private List<BaseItem> _lightOnItems;
|
||||
|
||||
[SerializeField]
|
||||
private InteractZone _bookZone;
|
||||
|
||||
public override string LevelName => "Workshop Downstairs";
|
||||
|
||||
[SerializeField]
|
||||
public bool LightOn;
|
||||
|
||||
protected override UniTask PostLoadInternal()
|
||||
{
|
||||
LightOn = SaveManager.GetLevelFlag(LevelFlag.WorkshopDownstairsLightOn);
|
||||
ApplyLightState();
|
||||
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
protected override UniTask PostActivateInternal()
|
||||
{
|
||||
HandleTutorial();
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
|
||||
private void HandleTutorial()
|
||||
{
|
||||
TutorialService.DisplayTutorial(TutorialPopupID.DarkRooms);
|
||||
}
|
||||
|
||||
public void ToggleLightSwitch()
|
||||
{
|
||||
LightOn = !LightOn;
|
||||
ApplyLightState();
|
||||
SaveManager.SetLevelFlag(LevelFlag.WorkshopDownstairsLightOn, LightOn);
|
||||
}
|
||||
|
||||
private void ApplyLightState()
|
||||
{
|
||||
_background.sprite = LightOn ? _lightOnSprite : _lightOffSprite;
|
||||
|
||||
foreach (var item in _lightOnItems)
|
||||
{
|
||||
item.CanvasGroup.alpha = LightOn ? 1f : 0.6f;
|
||||
item.CanvasGroup.interactable = LightOn;
|
||||
item.CanvasGroup.blocksRaycasts = LightOn;
|
||||
}
|
||||
|
||||
if (_bookZone != null)
|
||||
{
|
||||
_bookZone.CanvasGroup.interactable = LightOn;
|
||||
_bookZone.CanvasGroup.blocksRaycasts = LightOn;
|
||||
_bookZone.CanvasGroup.alpha = LightOn ? 1f : 0.6f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0aa09bf77262464c8d780da94250cd22
|
||||
timeCreated: 1773608254
|
||||
@@ -0,0 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
using BriarQueen.Data.Identifiers;
|
||||
using BriarQueen.Framework.Managers.Hints.Data;
|
||||
using BriarQueen.Framework.Managers.Levels.Data;
|
||||
|
||||
namespace BriarQueen.Game.Levels.ChapterOne.Workshop
|
||||
{
|
||||
public class WorkshopDrawer : BaseLevel
|
||||
{
|
||||
public override string LevelName => "Open Drawer";
|
||||
|
||||
public override bool IsPuzzleLevel => false;
|
||||
public override int CurrentLevelHintStage { get; set; }
|
||||
public override Dictionary<int, BaseHint> Hints { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7250337611264db1981b78673c6d8626
|
||||
timeCreated: 1772631648
|
||||
Reference in New Issue
Block a user