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
Branches
Tags
No related merge requests found
......@@ -16,18 +16,19 @@ 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();
//------------------------------------------------------------------------------------
//-------------------------------Global Variables-------------------------------------
// TODO! move to GlobalStatic/Behaviour
......
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
public class ShinyThings : MonoBehaviour
......@@ -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
}
......@@ -84,6 +85,12 @@ 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
......@@ -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,9 +194,10 @@ 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
if(gameObject != null) {
switch (StageStatic.mode = mode)
{
case Mode.Play:
......@@ -206,6 +207,7 @@ public static void SetMode(Mode mode, GameObject gameObject = null)
gameObject.SetActiveByTagRecursive("CreatorMode", true);
break;
}
}
// handle stage mode
switch (mode)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment