merge EmissionToggle and EmissionColor into one, deprecates RingLight
This commit is contained in:
@@ -203,6 +203,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 17de1e2991b64847bceea06f966f0560, type: 3}
|
m_Script: {fileID: 11500000, guid: 17de1e2991b64847bceea06f966f0560, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
color: {r: 8, g: 3.5137255, b: 0, a: 1}
|
||||||
--- !u!114 &588859562845345223
|
--- !u!114 &588859562845345223
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -313,6 +314,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 17de1e2991b64847bceea06f966f0560, type: 3}
|
m_Script: {fileID: 11500000, guid: 17de1e2991b64847bceea06f966f0560, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
color: {r: 8, g: 3.5137255, b: 0, a: 1}
|
||||||
--- !u!114 &1496886773925654589
|
--- !u!114 &1496886773925654589
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -436,6 +438,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 17de1e2991b64847bceea06f966f0560, type: 3}
|
m_Script: {fileID: 11500000, guid: 17de1e2991b64847bceea06f966f0560, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
color: {r: 8, g: 3.5137255, b: 0, a: 1}
|
||||||
--- !u!1 &3567493004391185636
|
--- !u!1 &3567493004391185636
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -448,8 +451,6 @@ GameObject:
|
|||||||
- component: {fileID: 3885302599737197913}
|
- component: {fileID: 3885302599737197913}
|
||||||
- component: {fileID: 8071682251213623948}
|
- component: {fileID: 8071682251213623948}
|
||||||
- component: {fileID: 1320470883464003968}
|
- component: {fileID: 1320470883464003968}
|
||||||
- component: {fileID: 2937406622804644192}
|
|
||||||
- component: {fileID: 2447623283058598807}
|
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Light
|
m_Name: Light
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@@ -534,31 +535,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 17de1e2991b64847bceea06f966f0560, type: 3}
|
m_Script: {fileID: 11500000, guid: 17de1e2991b64847bceea06f966f0560, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
--- !u!114 &2937406622804644192
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 3567493004391185636}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 59658196528346f7a5af3e879a1a8af1, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
color: {r: 0, g: 0, b: 0, a: 0}
|
color: {r: 0, g: 0, b: 0, a: 0}
|
||||||
--- !u!114 &2447623283058598807
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 3567493004391185636}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: a8f20dfd8ae64b4d87b98590269b7298, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
--- !u!1 &3629096364680104226
|
--- !u!1 &3629096364680104226
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -656,6 +633,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 17de1e2991b64847bceea06f966f0560, type: 3}
|
m_Script: {fileID: 11500000, guid: 17de1e2991b64847bceea06f966f0560, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
color: {r: 8, g: 3.5137255, b: 0, a: 1}
|
||||||
--- !u!114 &8332558567568654656
|
--- !u!114 &8332558567568654656
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -950,8 +928,7 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
theme: {fileID: 11400000, guid: 568d9a7d70f3edb4cb6db66a0010f105, type: 2}
|
theme: {fileID: 11400000, guid: 568d9a7d70f3edb4cb6db66a0010f105, type: 2}
|
||||||
animator: {fileID: 0}
|
ringLight: {fileID: 1320470883464003968}
|
||||||
ringLight: {fileID: 2447623283058598807}
|
|
||||||
ring: {fileID: 5086091638728871387}
|
ring: {fileID: 5086091638728871387}
|
||||||
--- !u!95 &2153737246840746917
|
--- !u!95 &2153737246840746917
|
||||||
Animator:
|
Animator:
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using Escape_Room_Engine.Desert.Scripts;
|
||||||
using Escape_Room_Engine.Engine.Scripts.Modules;
|
using Escape_Room_Engine.Engine.Scripts.Modules;
|
||||||
using NaughtyAttributes;
|
using NaughtyAttributes;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@@ -10,7 +11,7 @@ namespace Escape_Room_Engine.Desert.Modules.Puzzle_A.Scripts
|
|||||||
{
|
{
|
||||||
private static readonly int LightFlash = Animator.StringToHash("Light Flash");
|
private static readonly int LightFlash = Animator.StringToHash("Light Flash");
|
||||||
|
|
||||||
[BoxGroup("Internal")] [Required] public RingLight ringLight;
|
[BoxGroup("Internal")] [Required] public Emission ringLight;
|
||||||
[BoxGroup("Internal")] [Required] public Ring ring;
|
[BoxGroup("Internal")] [Required] public Ring ring;
|
||||||
|
|
||||||
private Animator _animator;
|
private Animator _animator;
|
||||||
@@ -32,11 +33,11 @@ namespace Escape_Room_Engine.Desert.Modules.Puzzle_A.Scripts
|
|||||||
break;
|
break;
|
||||||
case PuzzleEventType.Solved:
|
case PuzzleEventType.Solved:
|
||||||
ring.Solved = true;
|
ring.Solved = true;
|
||||||
ringLight.Color = theme.solvedColor;
|
ringLight.color = theme.solvedColor;
|
||||||
TurnOnRingLight();
|
TurnOnRingLight();
|
||||||
break;
|
break;
|
||||||
case PuzzleEventType.WrongInput:
|
case PuzzleEventType.WrongInput:
|
||||||
ringLight.Color = theme.puzzleColor;
|
ringLight.color = theme.puzzleColor;
|
||||||
_animator.SetTrigger(LightFlash);
|
_animator.SetTrigger(LightFlash);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -47,12 +48,12 @@ namespace Escape_Room_Engine.Desert.Modules.Puzzle_A.Scripts
|
|||||||
|
|
||||||
public void TurnOnRingLight()
|
public void TurnOnRingLight()
|
||||||
{
|
{
|
||||||
ringLight.Active = true;
|
ringLight.active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TurnOffRingLight()
|
public void TurnOffRingLight()
|
||||||
{
|
{
|
||||||
ringLight.Active = false;
|
ringLight.active = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace Escape_Room_Engine.Desert.Modules.Puzzle_A.Scripts
|
namespace Escape_Room_Engine.Desert.Modules.Puzzle_A.Scripts
|
||||||
{
|
{
|
||||||
[RequireComponent(typeof(EmissionToggle))]
|
[RequireComponent(typeof(Emission))]
|
||||||
public class Crystal : MonoBehaviour
|
public class Crystal : MonoBehaviour
|
||||||
{
|
{
|
||||||
[Required] public Light crystalLight;
|
[Required] public Light crystalLight;
|
||||||
@@ -19,11 +19,11 @@ namespace Escape_Room_Engine.Desert.Modules.Puzzle_A.Scripts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private EmissionToggle _emission;
|
private Emission _emission;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
_emission = GetComponent<EmissionToggle>();
|
_emission = GetComponent<Emission>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
using Escape_Room_Engine.Desert.Scripts;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace Escape_Room_Engine.Desert.Modules.Puzzle_A.Scripts
|
|
||||||
{
|
|
||||||
[RequireComponent(typeof(EmissionToggle), typeof(EmissionColor))]
|
|
||||||
public class RingLight : MonoBehaviour
|
|
||||||
{
|
|
||||||
public bool Active
|
|
||||||
{
|
|
||||||
get => _emissionToggle.active;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_emissionToggle.active = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public Color Color
|
|
||||||
{
|
|
||||||
get => _emissionColor.color;
|
|
||||||
set => _emissionColor.color = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
private EmissionToggle _emissionToggle;
|
|
||||||
private EmissionColor _emissionColor;
|
|
||||||
|
|
||||||
private void Awake()
|
|
||||||
{
|
|
||||||
_emissionToggle = GetComponent<EmissionToggle>();
|
|
||||||
_emissionColor = GetComponent<EmissionColor>();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Start()
|
|
||||||
{
|
|
||||||
Active = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: a8f20dfd8ae64b4d87b98590269b7298
|
|
||||||
timeCreated: 1668704631
|
|
||||||
@@ -3,7 +3,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace Escape_Room_Engine.Desert.Modules.Puzzle_A.Scripts
|
namespace Escape_Room_Engine.Desert.Modules.Puzzle_A.Scripts
|
||||||
{
|
{
|
||||||
[RequireComponent(typeof(EmissionToggle))]
|
[RequireComponent(typeof(Emission))]
|
||||||
public class Symbol : MonoBehaviour
|
public class Symbol : MonoBehaviour
|
||||||
{
|
{
|
||||||
public float anglePosition;
|
public float anglePosition;
|
||||||
@@ -17,11 +17,11 @@ namespace Escape_Room_Engine.Desert.Modules.Puzzle_A.Scripts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private EmissionToggle _emission;
|
private Emission _emission;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
_emission = GetComponent<EmissionToggle>();
|
_emission = GetComponent<Emission>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
|
|||||||
@@ -2,11 +2,15 @@
|
|||||||
|
|
||||||
namespace Escape_Room_Engine.Desert.Scripts
|
namespace Escape_Room_Engine.Desert.Scripts
|
||||||
{
|
{
|
||||||
public class EmissionToggle : MonoBehaviour
|
public class Emission : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
private static readonly int EmissionColorNameID = Shader.PropertyToID("_EmissionColor");
|
||||||
|
|
||||||
internal bool active;
|
internal bool active;
|
||||||
|
[ColorUsage(false, true)] public Color color;
|
||||||
|
|
||||||
private bool _previousActive;
|
private bool _previousActive;
|
||||||
|
private Color _previousColor;
|
||||||
private Material _material;
|
private Material _material;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
@@ -16,19 +20,26 @@ namespace Escape_Room_Engine.Desert.Scripts
|
|||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
Changed();
|
ChangedToggle();
|
||||||
|
ChangedColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
if (_previousActive != active)
|
if (_previousActive != active)
|
||||||
{
|
{
|
||||||
Changed();
|
ChangedToggle();
|
||||||
_previousActive = active;
|
_previousActive = active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_previousColor.Equals(color))
|
||||||
|
{
|
||||||
|
ChangedColor();
|
||||||
|
_previousColor = color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Changed()
|
private void ChangedToggle()
|
||||||
{
|
{
|
||||||
if (active)
|
if (active)
|
||||||
{
|
{
|
||||||
@@ -40,9 +51,9 @@ namespace Escape_Room_Engine.Desert.Scripts
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetActive(bool to)
|
private void ChangedColor()
|
||||||
{
|
{
|
||||||
this.active = to;
|
_material.SetColor(EmissionColorNameID, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace Escape_Room_Engine.Desert.Scripts
|
|
||||||
{
|
|
||||||
public class EmissionColor : MonoBehaviour
|
|
||||||
{
|
|
||||||
private static readonly int EmissionColorNameID = Shader.PropertyToID("_EmissionColor");
|
|
||||||
|
|
||||||
public Color color;
|
|
||||||
|
|
||||||
private Color _previousColor;
|
|
||||||
private Material _material;
|
|
||||||
|
|
||||||
private void Awake()
|
|
||||||
{
|
|
||||||
_material = GetComponent<Renderer>().material;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Start()
|
|
||||||
{
|
|
||||||
Changed();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Update()
|
|
||||||
{
|
|
||||||
if (!_previousColor.Equals(color))
|
|
||||||
{
|
|
||||||
Changed();
|
|
||||||
_previousColor = color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Changed()
|
|
||||||
{
|
|
||||||
_material.SetColor(EmissionColorNameID, color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 59658196528346f7a5af3e879a1a8af1
|
|
||||||
timeCreated: 1668704714
|
|
||||||
Reference in New Issue
Block a user