usingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;publicclassObstacleSpawner:MonoBehaviour{privateEventTimelinetimeline=newEventTimeline();publicGameObjectalfaPrefab;publicGameObjectbetaPrefab;publicfloatspawnLine;privatevoidspawnOnEvent(EventTimeline.SpawnEvente){GameObjectprefab=null;if(e.type==EventTimeline.SpawnEventType.alfa)prefab=alfaPrefab;if(e.type==EventTimeline.SpawnEventType.beta)prefab=betaPrefab;Instantiate(prefab,newVector3(spawnLine,e.height,0),Quaternion.identity);}voidStart(){timeline.Add(2,2,EventTimeline.SpawnEventType.alfa);timeline.Add(4,2,EventTimeline.SpawnEventType.beta);timeline.Add(5,-2,EventTimeline.SpawnEventType.beta);timeline.Add(7,-3,EventTimeline.SpawnEventType.alfa);timeline.OnSpawnEvent+=spawnOnEvent;}// Update is called once per framevoidUpdate(){timeline.timeTick(Time.deltaTime);}voidOnDrawGizmosSelected(){Gizmos.color=Color.green;Gizmos.DrawLine(newVector3(spawnLine,-10,0),newVector3(spawnLine,10,0));}}