51 lines
1.4 KiB
C#
51 lines
1.4 KiB
C#
using System;
|
|
using UnityEngine;
|
|
using UnityEngine.Rendering.Universal;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
public class AblaufKleinerStern5 : MonoBehaviour
|
|
{
|
|
public GameObject kleinerStern;
|
|
|
|
private Action nextStep;
|
|
private float nextScene;
|
|
private Lichtsteuerung kleinerSternLight;
|
|
|
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
|
void Start()
|
|
{
|
|
nextStep = SternWachtAuf;
|
|
nextScene = float.PositiveInfinity;
|
|
kleinerSternLight = kleinerStern.GetComponent<Lichtsteuerung>();
|
|
kleinerStern.GetComponent<Light2D>().intensity = 0;
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
if (Input.GetKeyDown(KeyCode.Space)){
|
|
nextStep();
|
|
}
|
|
if (Time.time >= nextScene){
|
|
SceneManager.LoadScene("kleiner_Stern_6");
|
|
}
|
|
}
|
|
|
|
private void SternWachtAuf(){
|
|
kleinerSternLight.FadeToIntensity(0.7f, 1.5f);
|
|
nextStep = Aufblenden;
|
|
}
|
|
|
|
private void Aufblenden(){
|
|
kleinerSternLight.FadeToIntensity(1, 0.5f);
|
|
kleinerSternLight.FadeToInnerRadius(1, 0.7f);
|
|
kleinerSternLight.FadeToOuterRadius(9, 3);
|
|
nextStep = SternSchlaeftEin;
|
|
}
|
|
|
|
private void SternSchlaeftEin(){
|
|
kleinerSternLight.FadeToIntensity(0, 3);
|
|
nextScene = Time.time + 3.1f;
|
|
nextStep = delegate(){};
|
|
}
|
|
}
|