Skip to content
Snippets Groups Projects
Select Git revision
  • 1903af66b7b2c9ce733df9cb2efc77e3b3cce343
  • master default
  • JS-based-scroll-rendering
  • Paul_Marius_Level
  • Paul_Marius_2
  • Paul_Marius
  • Andi_Mark
  • be-UnityWebView
  • gitignoreFrameitServer
  • ZimmerBSc
  • Bugfix_StageLoading
  • stages
  • MAZIFAU_Experimental
  • tsc/coneworld
  • tsc/fact-interaction
  • marcel
  • MaZiFAU_TopSort
  • mergeHelper
  • zwischenSpeichern
  • tempAndrToMaster
  • SebBranch
  • 3.0
  • v2.1
  • v2.0
  • v1.0
25 results

ShinyThings.cs

Blame
  • 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;