Select Git revision
ShinyThings.cs
-
Marco Zimmer authoredMarco Zimmer authored
ShinyThings.cs 12.77 KiB
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using static CommunicationEvents;
using System;
public class ShinyThings : MonoBehaviour
{
public WorldCursor Cursor;
//Attributes for Highlighting of Facts when Mouse-Over
private string selectableTag = "Selectable";
private Transform lastFactSelection;
public Material defaultMaterial;
public Material highlightMaterial;
//Variables for Pushout-Highlighting
private Fact highlightedPushoutFact;
private GameObject extraHighlight;
private bool timerActive { get; set; }
private float timer { get; set; }
private float timerDuration = 2.5f;
private float timerDurationEnd = 5.0f;
private int slowDownCount = 8;
private int slowDownCounter;
private bool[] slowDownSwitch;
private float simulationSpeed;
private Boolean pushoutFail;
public GameObject directionalLight;
private Color lightColor;
private Color tempColor;
private Color darkColor;
private Boolean factAnimationActive = false;
private float speedSlowDown;
public Material pushoutMaterial;
private Material tempMaterial;
public GameObject
Fireworks_Animation,
RainPrefab;
// Start is called before the first frame update
public void Start()
{
if (Cursor == null)
Cursor = GetComponent<WorldCursor>();
if (directionalLight == null)
directionalLight = FindObjectOfType<Light>().gameObject;
CommunicationEvents.PushoutFactEvent.AddListener(HighlightFact);
CommunicationEvents.PushoutFactFailEvent.AddListener(StartPushoutFactFailHighlighting);
CommunicationEvents.AnimateExistingFactEvent.AddListener(HighlightWithFireworks);
speedSlowDown = timerDurationEnd * 10;
lightColor = directionalLight.GetComponent<Light>().color;
slowDownSwitch = new bool[slowDownCount];
Array.Clear(slowDownSwitch, 0, slowDownSwitch.Length);
this.timerActive = false;
this.timer = 0;
}
// Update is called once per frame
public void Update()
{
//SELECTION-HIGHLIGHTING-PART
//Check if a Fact was Hit
RaycastHit Hit = Cursor.Hit;