using System; using UnityEngine; public class AblaufKleinerStern3 : MonoBehaviour { public GameObject mariaAufEsel; private Action nextStep; // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() { nextStep = AuftrittMariaUndJoseph; } // Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Space)){ nextStep(); } } private void AuftrittMariaUndJoseph(){ mariaAufEsel.GetComponent().GoToXPosition(1); nextStep = AuftrittKleinerStern; } private void AuftrittKleinerStern(){ nextStep = EinStueckWeiter; } private void EinStueckWeiter(){ nextStep = Abgang; } private void Abgang(){ nextStep = delegate(){}; } }