This commit is contained in:
2022-11-30 22:32:10 +01:00
parent 2b3daeadc2
commit ae3c6a50f5
35 changed files with 4502 additions and 7 deletions

View File

@@ -46,6 +46,7 @@ namespace EscapeRoomEngine.Desert.Runtime.Puzzle_A
PuzzleEvent += (_, type) =>
{
// ReSharper disable once SwitchStatementHandlesSomeKnownEnumValuesWithDefault
switch (type)
{
case PuzzleEventType.Restarted:
@@ -61,8 +62,6 @@ namespace EscapeRoomEngine.Desert.Runtime.Puzzle_A
case PuzzleEventType.WrongInput:
_animator.SetTrigger(LightFlash);
break;
default:
throw new ArgumentOutOfRangeException(nameof(type), type, null);
}
};

View File

@@ -47,6 +47,7 @@ namespace EscapeRoomEngine.Desert.Runtime.Puzzle_B
PuzzleEvent += (_, type) =>
{
// ReSharper disable once SwitchStatementMissingSomeEnumCasesNoDefault
switch (type)
{
case PuzzleEventType.Restarted:
@@ -61,10 +62,6 @@ namespace EscapeRoomEngine.Desert.Runtime.Puzzle_B
rotators.ForEach(rotator => rotator.Emission.color = _solvedColor.hdr);
buttonActions.ForEach(action => action.button.Disable());
break;
case PuzzleEventType.WrongInput:
break;
default:
throw new ArgumentOutOfRangeException(nameof(type), type, null);
}
};

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3ec2f8925bad45d189d951bc02b39c11
timeCreated: 1669815308

View File

@@ -0,0 +1,57 @@
using EscapeRoomEngine.Engine.Runtime.Utilities;
using UnityEngine;
namespace EscapeRoomEngine.Desert.Runtime.Puzzle_C
{
[RequireComponent(typeof(Emission), typeof(Collider))]
public class Hole : Button
{
[Min(0)]
public int number;
public Emission Emission { get; private set; }
private DynamicColor _puzzleColor, _activeColor;
private void Awake()
{
Emission = GetComponent<Emission>();
_puzzleColor = Engine.Runtime.Engine.DefaultEngine.theme.puzzleColor;
_activeColor = Engine.Runtime.Engine.DefaultEngine.theme.activeColor;
}
protected override void Start()
{
base.Start();
Emission.active = true;
}
private void OnTriggerEnter(Collider other)
{
var orb = other.GetComponent<HoleOrb>();
if (orb != null)
{
if (Active)
{
Press();
Emission.color = _activeColor.hdr;
}
}
}
private void OnTriggerExit(Collider other)
{
var orb = other.GetComponent<HoleOrb>();
if (orb != null)
{
if (Active)
{
Release();
Emission.color = _puzzleColor.hdr;
}
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 05ccb586cbc54f9e8c46ade911449f7f
timeCreated: 1669815357

View File

@@ -0,0 +1,10 @@
using UnityEngine;
namespace EscapeRoomEngine.Desert.Runtime.Puzzle_C
{
[RequireComponent(typeof(Rigidbody), typeof(Collider))]
public class HoleOrb : MonoBehaviour
{
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 461335b38aec4817a787dae9c5a63f0b
timeCreated: 1669815545

View File

@@ -0,0 +1,72 @@
using System.Collections.Generic;
using EscapeRoomEngine.Engine.Runtime.Modules;
using EscapeRoomEngine.Engine.Runtime.Utilities;
using NaughtyAttributes;
using UnityEngine;
namespace EscapeRoomEngine.Desert.Runtime.Puzzle_C
{
public class Holes : StatePuzzle
{
[BoxGroup("Internal")] [SerializeField]
private Emission frameLight;
private List<Hole> _holes;
private DynamicColor _puzzleColor, _solvedColor, _activeColor;
protected override void Awake()
{
base.Awake();
_holes = new List<Hole>(GetComponentsInChildren<Hole>());
_puzzleColor = Engine.Runtime.Engine.DefaultEngine.theme.puzzleColor;
_solvedColor = Engine.Runtime.Engine.DefaultEngine.theme.solvedColor;
_activeColor = Engine.Runtime.Engine.DefaultEngine.theme.activeColor;
}
protected override void Start()
{
base.Start();
PuzzleEvent += (_, type) =>
{
// ReSharper disable once SwitchStatementMissingSomeEnumCasesNoDefault
switch (type)
{
case PuzzleEventType.Restarted:
_holes.ForEach(hole =>
{
hole.Enable();
hole.Emission.color = _puzzleColor.hdr;
});
frameLight.color = _puzzleColor.hdr;
break;
case PuzzleEventType.Solved:
_holes.ForEach(hole =>
{
hole.Disable();
hole.Emission.color = solution[hole.number] == 1 ? _activeColor.hdr : _solvedColor.hdr;
});
frameLight.color = _solvedColor.hdr;
break;
}
};
_holes.ForEach(hole => hole.ButtonEvent += (_, type) =>
{
// ReSharper disable once SwitchStatementMissingSomeEnumCasesNoDefault
switch (type)
{
case ButtonEventType.Pressed:
SetState(hole.number, 1, true);
break;
case ButtonEventType.Released:
SetState(hole.number, 0, true);
break;
}
});
frameLight.active = true;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ce1763e3c7644933af2ff398ba6355b9
timeCreated: 1669815316