Skip to content
Snippets Groups Projects
Commit 9ad0b51f authored by Jacktheholdy's avatar Jacktheholdy
Browse files

Added Gadget Name Display and a popup window showing scroll application errors.

Added an animation at the wrongly assigned fact conteiners in scroll
parent deaf5bd7
No related branches found
No related tags found
No related merge requests found
......@@ -16,16 +16,17 @@ public static class CommunicationEvents
public static UnityEvent<Fact> RemoveFactEvent = new();
public static UnityEvent<Fact, FactObject.FactMaterials> PushoutFactEvent = new();
public static UnityEvent<Fact> PushoutFactFailEvent = new();
public static UnityEvent<Fact, Scroll.ScrollApplicationInfo> PushoutFactFailEvent = new();
public static UnityEvent gameSucceededEvent = new();
public static UnityEvent gameNotSucceededEvent = new();
public static UnityEvent NewAssignmentEvent = new();
public static UnityEvent<GameObject, string> ScrollFactHintEvent = new();
public static UnityEvent<Fact> AnimateExistingFactEvent = new();
public static UnityEvent<Fact, FactObject.FactMaterials> AnimateExistingFactEvent = new();
public static UnityEvent<Fact> AnimateNonExistingFactEvent = new();
public static UnityEvent<List<string>> HintAvailableEvent = new();
//------------------------------------------------------------------------------------
......
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
public class ShinyThings : MonoBehaviour
......@@ -17,7 +16,7 @@ public class ShinyThings : MonoBehaviour
private IEnumerator rain;
public Light directionalLight;
private Color darkColor = new (0.2f, 0.2f, 0.2f);
private Color darkColor = new(0.2f, 0.2f, 0.2f);
private Color light_colour;
private GameObject active_rainwork;
......@@ -29,8 +28,10 @@ public GameObject
private void Awake()
{
CommunicationEvents.PushoutFactEvent.AddListener(HighlightFact);
CommunicationEvents.PushoutFactEvent.AddListener(HighlightWithFireworks);
CommunicationEvents.AnimateExistingFactEvent.AddListener(HighlightFact);
CommunicationEvents.PushoutFactFailEvent.AddListener(LetItRain);
CommunicationEvents.AnimateExistingFactEvent.AddListener(HighlightWithFireworks);
//CommunicationEvents.AnimateExistingAsSolutionEvent.AddListener(HighlightWithFireworks);
rain = rain_wait = 0f.LerpInTime(0, 0, -1); // yield return break
}
......@@ -83,7 +84,13 @@ void ApplyMaterial(FactObject root, Material new_mat) =>
}
public static void HighlightFact(Fact startFact, FactObject.FactMaterials tmp_mat)
{
{
//this happens, but it should not! TODO: Fix Fact Hint creation
if (startFact == null)
{
Debug.Log("FEHLER! fact = null");
return;
}
if (startFact.Representation == null)
return;
FactObject selected_fact_obj = startFact.Representation.GetComponentInChildren<FactObject>();
......@@ -97,7 +104,8 @@ public static void HighlightFact(Fact startFact, FactObject.FactMaterials tmp_ma
);
}
public void HighlightWithFireworks(Fact fact)
//Highlight winning fact with fireworks. material is not used;
public void HighlightWithFireworks(Fact fact, FactObject.FactMaterials material)
{
while (rain_wait.MoveNext()) ; //stop rain
......@@ -107,7 +115,7 @@ public void HighlightWithFireworks(Fact fact)
IEnumerator BlossomAndDie()
{
GameObject firework = GameObject.Instantiate
( Fireworks_Animation
(Fireworks_Animation
, fact.Representation.transform
);
......@@ -127,11 +135,13 @@ IEnumerator BlossomAndDie()
}
}
public void LetItRain(Fact startFact)
public void LetItRain(Fact startFact, Scroll.ScrollApplicationInfo info)
{
//-----------------
bool restart = !rain_wait.MoveNext();
if (restart) {
if (restart)
{
StopCoroutine(rain);
StartCoroutine(rain = BlossomAndDie());
}
......
......@@ -85,7 +85,7 @@ void Start()
AddFactEvent.AddListener(AddFact);
RemoveFactEvent.AddListener(RemoveFact);
AnimateExistingFactEvent.AddListener(AnimateFact);
//AnimateExistingFactEvent.AddListener(AnimateFact);
}
public void AddFact(Fact fact) {
......
......@@ -438,7 +438,7 @@ public bool CheckSolved()
{
foreach (var hitlist in hits)
foreach (var hit in hitlist)
AnimateExistingFactEvent.Invoke(factState[hit]);
AnimateExistingFactEvent.Invoke(factState[hit], FactObject.FactMaterials.Solution);
player_record.solved = true;
push_record(time_s);
......
......@@ -194,17 +194,19 @@ public StageErrorStruct(bool category, bool id, bool name, bool description, boo
/// <param name="gameObject"> which children will be checked</param>
public static void SetMode(Mode mode, GameObject gameObject = null)
{
gameObject ??= new GameObject();
//gameObject ??= new GameObject();
// handle StageStatic.mode
switch (StageStatic.mode = mode)
{
case Mode.Play:
gameObject.SetActiveByTagRecursive("CreatorMode", false);
break;
case Mode.Create:
gameObject.SetActiveByTagRecursive("CreatorMode", true);
break;
if(gameObject != null) {
switch (StageStatic.mode = mode)
{
case Mode.Play:
gameObject.SetActiveByTagRecursive("CreatorMode", false);
break;
case Mode.Create:
gameObject.SetActiveByTagRecursive("CreatorMode", true);
break;
}
}
// handle stage mode
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment