void arrowSpawner(string[] data) { if (data [0] == "s") { zArrowSpeed = int.Parse(data[1]); notesPreSpawn.RemoveAt(0); return; } int offset = int.Parse(data[0]); if (currentTime >= offset - spawnPreTime) { string note = notesPreSpawn[0]; List <GameObject> noteObjects = new List <GameObject>(); for (int i = 1; i < data.Length; i++) { int direction = int.Parse(data[i]) - 1; GameObject newObject = (GameObject)Instantiate(arrowsMove[direction], arrows[direction].transform.position + Vector3.down * zArrowSpawn, Quaternion.Euler(0, 0, 0)); moveUp moveScript = (moveUp)newObject.GetComponent <moveUp>(); moveScript.setSpeed(zArrowSpeed); noteObjects.Add(newObject); } spawnedNotes.Add(noteObjects); notesPostSpawn.Add(note); notesPreSpawn.RemoveAt(0); } }
// Start is called before the first frame update void Start() { //初始化对象 //山和云的对象 LB_11 = GameObject.FindWithTag("BackGround_11").GetComponent <LoopBack>(); LB_12 = GameObject.FindWithTag("BackGround_12").GetComponent <LoopBack>(); LB_13 = GameObject.FindWithTag("BackGround_13").GetComponent <LoopBack>(); LB_21 = GameObject.FindWithTag("BackGround_21").GetComponent <LoopBack>(); LB_22 = GameObject.FindWithTag("BackGround_22").GetComponent <LoopBack>(); LB_23 = GameObject.FindWithTag("BackGround_23").GetComponent <LoopBack>(); LB_31 = GameObject.FindWithTag("BackGround_31").GetComponent <LoopBack>(); LB_32 = GameObject.FindWithTag("BackGround_32").GetComponent <LoopBack>(); LB_33 = GameObject.FindWithTag("BackGround_33").GetComponent <LoopBack>(); LB_41 = GameObject.FindWithTag("BackGround_41").GetComponent <LoopBack>(); LB_42 = GameObject.FindWithTag("BackGround_42").GetComponent <LoopBack>(); LB_43 = GameObject.FindWithTag("BackGround_43").GetComponent <LoopBack>(); LB_51 = GameObject.FindWithTag("BackGround_51").GetComponent <LoopBack>(); LB_52 = GameObject.FindWithTag("BackGround_52").GetComponent <LoopBack>(); LB_53 = GameObject.FindWithTag("BackGround_53").GetComponent <LoopBack>(); LB_61 = GameObject.FindWithTag("BackGround_61").GetComponent <LoopBack>(); LB_62 = GameObject.FindWithTag("BackGround_62").GetComponent <LoopBack>(); LB_63 = GameObject.FindWithTag("BackGround_63").GetComponent <LoopBack>(); //树林的对象 LBFT_11 = GameObject.FindWithTag("small_1").GetComponent <LoopBackForTree>(); LBFT_12 = GameObject.FindWithTag("middle_1").GetComponent <LoopBackForTree>(); LBFT_13 = GameObject.FindWithTag("big_1").GetComponent <LoopBackForTree>(); LBFT_21 = GameObject.FindWithTag("small_2").GetComponent <LoopBackForTree>(); LBFT_22 = GameObject.FindWithTag("middle_2").GetComponent <LoopBackForTree>(); LBFT_23 = GameObject.FindWithTag("big_2").GetComponent <LoopBackForTree>(); //地面的对象 LFG_11 = GameObject.FindWithTag("ground_1").GetComponent <LoopForGround>(); LFG_12 = GameObject.FindWithTag("ground_11").GetComponent <LoopForGround>(); LFG_21 = GameObject.FindWithTag("ground_2").GetComponent <LoopForGround>(); LFG_22 = GameObject.FindWithTag("ground_22").GetComponent <LoopForGround>(); //小麦的对象 wh = GameObject.FindWithTag("wheat").GetComponent <wheat>(); //黄河的对象 mR = GameObject.FindWithTag("river").GetComponent <moveRiver>(); //河里的水的对象 RMD = GameObject.FindWithTag("water").GetComponent <RiverMoveDown>(); // sT = GameObject.FindWithTag("stone").GetComponent <stone>(); sT_2 = GameObject.FindWithTag("stone_2").GetComponent <stone>(); // th_1 = GameObject.FindWithTag("thorns_1").GetComponent <thorns>(); th_2 = GameObject.FindWithTag("thorns_2").GetComponent <thorns>(); // mU = GameObject.FindWithTag("peach").GetComponent <moveUp>(); }