public override void Setup() { pipeList = new List <AbstractControl>(); pipeLinkedList = new LinkedList <AbstractControl>(); for (int i = 0; i < 3; i++) { Vector3 pos; if (i == 0) { pos = new Vector3(gameView.localPosition.x + 40, gameView.localPosition.y + GetRandomLocalY()); } else { pos = new Vector3(gameView.localPosition.x + i * 40 + GetRandomLocalX(), gameView.localPosition.y + GetRandomLocalY()); } pipeControl = PoolController.Use(ControlPrefab, pos) as PipeControl; pipeControl.PipeOffScreen += OnPipeOffScreen; pipeLinkedList.AddLast(pipeControl); pipeList.Add(pipeControl); } if (!startGame) { StopPipe(); } }
public override void ReusePrefab() { AbstractControl lastBgControl = backGroundList[backGroundList.Count - 1]; Vector3 pos = new Vector2(lastBgControl.transform.localPosition.x + scalePref, lastBgControl.transform.localPosition.y); AbstractControl go = PoolController.Use(ControlPrefab, pos) as BackgroundControl; backGroundList.Add(go); backGroundList.Remove(backGroundList[backGroundList.Count - 1]); }
public override void ReusePrefab() { AbstractControl lastearth = earthList[earthList.Count - 1]; Vector3 pos = new Vector2(lastearth.transform.localPosition.x + scalePref, lastearth.transform.localPosition.y); AbstractControl go = PoolController.Use(ControlPrefab, pos) as EarthControl; earthList.Add(go); earthList.Remove(earthList[earthList.Count - 1]); }
public override void ReusePrefab() { AbstractControl lastPipe = pipeList[pipeList.Count - 1]; Vector3 pos = new Vector2(lastPipe.transform.localPosition.x + GetRandomLocalX(), gameView.transform.localPosition.y + GetRandomLocalY()); AbstractControl go = PoolController.Use(ControlPrefab, pos) as PipeControl; pipeList.Add(go); pipeList.Remove(pipeList[pipeList.Count - 1]); pipeLinkedList.AddLast(go); }
public override void Setup() { earthList = new List <AbstractControl>(); for (int i = 0; i < activePrefabCountbg; i++) { if (i == 0) { pos = new Vector2(gameView.localPosition.x, gameView.localPosition.y - 33); } else { pos = new Vector2(gameView.localPosition.x + scalePref, gameView.localPosition.y - 33); } earthControl = PoolController.Use(ControlPrefab, pos) as EarthControl; earthControl.PipeOffScreen += OnEarthOffScreen; earthList.Add(earthControl); } }
public override void Setup() { backGroundList = new List <AbstractControl>(); for (int i = 0; i < activePrefabCountbg; i++) { if (i == 0) { pos = new Vector2(gameView.localPosition.x, gameView.position.y); } else { pos = new Vector2(gameView.localPosition.x + scalePref, gameView.position.y); } bgControl = PoolController.Use(ControlPrefab, pos) as BackgroundControl; bgControl.PipeOffScreen += OnBackgroundOffScreen; backGroundList.Add(bgControl); GoOnInits1?.Invoke(bgControl); } }