void CAS_List_Init() { int allStep = 0; //共groupCount,group是他们的下标,正好从0开始 for (int group = 0; group < groupCount; group++) { //这个地方是否消耗会很大,能否优化 //获取第group组有多少个运动的物体(目标和本体) List <Transform> groupTarTrans = U_Transform.GetAddedStrTrans(transform, brother[group], mark, markDigit, false, group); List <Transform> groupOriTrans = U_Transform.GetAddedStrTrans(transform, brother[group], mark, markDigit, true, group); List <C_AssembleOBJ> tempASList = new List <C_AssembleOBJ>(); oriTrans_AllStep.AddRange(groupOriTrans); tarTrans_AllStep.AddRange(groupTarTrans); eachGroupCount.Add(groupTarTrans.Count); //每一组中的step步。 for (int step = 0; step < groupTarTrans.Count; step++) { //Debug.Log("allStep "+allStep+" ori 【"+oriTrans_AllStep[allStep].name+"】 tar 【" + tarTrans_AllStep[allStep].name + "】"); C_AssembleOBJ tempCAS = oriTrans_AllStep[allStep].GetComponent <C_AssembleOBJ>(); tempCAS.SetAssemble(tarTrans_AllStep[allStep], group, groupTarTrans.Count); tempASList.Add(tempCAS); allStep += 1; } tarGroupList.Add(groupTarTrans); oriGroupList.Add(groupOriTrans); casGroupList.Add(tempASList); } allStepCount = oriTrans_AllStep.Count; }
//基础初始化,例如兄弟个数等等 void Base_Init() { this.RemoveData(); this.brother = U_Transform.GetBrotherS(transform, false); this.groupCount = brother.Count; this.oriTrans_Obj = U_Transform.GetAddedStrTrans(transform, brother[brother.Count - 1], mark, markDigit, true); this.assembles_Obj = AddComponentCAS(oriTrans_Obj); }