//旋轉群組......................................... //創造旋轉群組 public Level1_RotationFix CreateGroup() { GameObject go = new GameObject("G" + L1DB.RotationGroup_Index++); go.transform.parent = L1DB.UFO_group; go.transform.localScale = Vector3.one; Level1_RotationFix rf = go.AddComponent <Level1_RotationFix> (); rf.Group = go; rf.direction = dir *= -1; return(rf); }
///關卡設定 public override IEnumerator LevelManagement(params object[] args) { //旋轉模式 var mode = (int)args [0]; //旋轉方向(順或逆) var dir = (int)args [1]; //排列地圖 var maps = (List <Vector3>)args [2]; //更新難度條 CT1.DisplaySliderBar(); //創造旋轉群組 Level1_RotationFix RotateGroup = CT1.CreateGroup(); if (mode == 0) { RotateGroup.direction = dir; } //建置UFO位置 UFO.UFO_group = RotateGroup.transform; var Balance = maps.Count; //多(少)幾台 var Group = UFO.InstantiateUFOs(Balance); //實例化UFO //重設場上所有UFO座標 for (int i = 0; i < Group.Count; i++) { Group [i].moveTo(0.7f, maps [i], true, 0.1f); } yield break; }
//移除整個RotationGroup物件,並移除所有子物件(UFO) public void DestoryGroup(Level1_RotationFix rf) { UFO.DestroyUFO(rf.transform.childCount); MonoBehaviour.Destroy(rf.gameObject, 0.5f); L1DB.RotationGroup_Index--; }