88 lines
2.4 KiB
C#
88 lines
2.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Rendering.Universal;
|
|
|
|
public class AblaufKleinerStern1 : MonoBehaviour
|
|
{
|
|
public GameObject kleinerStern;
|
|
|
|
public GameObject grosserStern;
|
|
|
|
public GameObject globalLight;
|
|
|
|
private enum Step {GROSSE_AUFREGUNG, AUFTRITT_KLEINER_STERN, AUFTRITT_GROSSER_STERN, ABGANG_GROSSER_STERN, KLEINER_STERN_FAELLT}
|
|
|
|
private Step nextStep;
|
|
|
|
private class Task {
|
|
public readonly float time;
|
|
public readonly Action action;
|
|
|
|
Task(float time, Action action) {
|
|
this.time = time;
|
|
this.action = action;
|
|
}
|
|
}
|
|
|
|
private List<Task> taskList;
|
|
|
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
|
void Start()
|
|
{
|
|
nextStep = Step.GROSSE_AUFREGUNG;
|
|
taskList = new List<Task>();
|
|
globalLight.GetComponent<Light2D>().intensity = 0;
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
List<Task> doneList = new List<Task>();
|
|
foreach (Task t in taskList) {
|
|
if (t.time >= Time.time) {
|
|
doneList.Add(t);
|
|
t.action();
|
|
}
|
|
}
|
|
foreach (Task t in doneList) {
|
|
taskList.Remove(t);
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.Space)){
|
|
switch (nextStep) {
|
|
case Step.GROSSE_AUFREGUNG:
|
|
GrosseAufregung();
|
|
nextStep = Step.AUFTRITT_KLEINER_STERN;
|
|
break;
|
|
case Step.AUFTRITT_KLEINER_STERN:
|
|
AuftrittKleinerStern();
|
|
nextStep = Step.AUFTRITT_GROSSER_STERN;
|
|
break;
|
|
case Step.AUFTRITT_GROSSER_STERN:
|
|
AuftrittGrosserStern();
|
|
nextStep = Step.ABGANG_GROSSER_STERN;
|
|
break;
|
|
case Step.ABGANG_GROSSER_STERN:
|
|
AbgangGrosserStern();
|
|
nextStep = Step.KLEINER_STERN_FAELLT;
|
|
break;
|
|
case Step.KLEINER_STERN_FAELLT:
|
|
KleinerSternFaellt();
|
|
break;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
private void GrosseAufregung(){
|
|
globalLight.GetComponent<Lichtsteuerung>().FadeToIntensity(1, 1);
|
|
}
|
|
|
|
private void AuftrittKleinerStern(){}
|
|
|
|
private void AuftrittGrosserStern(){}
|
|
|
|
private void AbgangGrosserStern(){}
|
|
|
|
private void KleinerSternFaellt(){}
|
|
}
|