usingSystem.Collections;usingSystem.Collections.Generic;usingUnityEngine;publicclassObstacleSpawner:MonoBehaviour{privateEventTimelinetimeline=newEventTimeline();publicGameObjectalfaPrefab;publicGameObjectbetaPrefab;publicLevelScrollingscrolling;publicfloatspawnLine;privatevoidspawnOnEvent(EventTimeline.SpawnEvente){GameObjectprefab=null;if(e.type==ObstacleType.alfa)prefab=alfaPrefab;if(e.type==ObstacleType.beta)prefab=betaPrefab;vartransformT=((GameObject)Instantiate(prefab,newVector3(spawnLine,e.height,0),Quaternion.identity)).transform;scrolling.Obstacles.Add(transformT);}voidStart(){for(inti=0;i<120;i+=5){timeline.Add(i,0,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));}}