using System;
using UnityEngine;
using UnityEngine.Rendering.Universal;

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();
        }
    }

    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);
        nextStep = delegate(){};
    }
}
