public void ChangeChildrenTag() { foreach (Transform tran in U_Transform.GetChildren(transform, true)) { tran.tag = tarTag; } }
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; }
public void GetBrother() { if (null == brother) { brother = U_Transform.GetCtrlD(transform); } }
//基础初始化,例如兄弟个数等等 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); }
void SetTarPosition() { if (tarPosList.Count != 0) { tarPosList.Clear(); } tarPosList = U_Transform.GetChildrenLocalPostion(transform); }
void SetOriPosition() { if (oriPosList.Count != 0) { oriPosList.Clear(); } oriPosList = U_Transform.GetChildrenLocalPostion(transform); }
public void DebugChildrenLocalPositionAndLocalEuler() { children = U_Transform.GetSonS(transform); foreach (Transform child in children) { Debug.Log(child.name + " position " + child.localPosition + " euler " + child.localEulerAngles); } }
public void Update() { //isFather,解除其所有子物体 U_Bool.BoolTrueMethord (removerChildren, ref isSonFlag, () => U_Transform.RemoveChildren(transform)); U_Bool.BoolTrueMethord (setParent, ref isFatherFlag, () => U_Transform.SetParent(transform, parent)); }
// 获得children的localEulerAngles public static List <Vector3> GetChildrenLocalEuler(Transform trans, bool containSelf = false) { List <Transform> children = U_Transform.GetChildren(trans, containSelf); List <Vector3> childrenLocalEuler = new List <Vector3>(); foreach (Transform t in children) { childrenLocalEuler.Add(trans.localEulerAngles); } return(childrenLocalEuler); }
//获取组件 public static List <T> GetTComponent <T>(Transform tran, WE_TransformRange transformRange = WE_TransformRange.Self) { List <T> tC = new List <T>(); switch (transformRange) { case WE_TransformRange.Self: tC.Add(tran.GetComponent <T>()); break; case WE_TransformRange.SelfSon: GetTC_FromTransforms <T>(U_Transform.GetSonS(tran, true)); break; case WE_TransformRange.SelfChildren: tC = GetTC_FromTransforms <T>(U_Transform.GetChildren(tran, true)); break; case WE_TransformRange.SelfBrother: tC = GetTC_FromTransforms <T>(U_Transform.GetBrotherS(tran, true)); break; case WE_TransformRange.Son: tC = GetTC_FromTransforms <T>(U_Transform.GetSonS(tran, false)); break; case WE_TransformRange.Children: GetTC_FromTransforms <T>(U_Transform.GetChildren(tran, false)); break; case WE_TransformRange.Brother: tC = GetTC_FromTransforms <T>(U_Transform.GetBrotherS(tran, false)); break; } return(tC); }
/// <summary> /// 获取当前物体所在的画布 /// </summary> /// <param name="rect"></param> /// <returns></returns> public static Transform GetCanvas(Transform rect) { if (rect.root.GetComponent <Canvas>() != null) { return(rect.root); } Canvas[] canvaS = rect.root.GetComponentsInChildren <Canvas>(true); if (canvaS.Length == 1) { return(canvaS[0].transform); } else { foreach (Canvas can in canvaS) { if (U_Transform.IsContainChildren(can.transform.GetChildren(), rect)) { return(can.transform); } } return(null); } }
private void Awake() { sonS = transform.GetSonS(false); sonGoS = U_Transform.TranS_To_GameObjectS(sonS); StartCoroutine(ActiveOneByOne(sonGoS, 1, 0, true)); }
void GetChildrenName() { childrenNames = U_Transform.GetChildrenName(transform); }
void GetChildren() { children = U_Transform.GetChildren(transform); }
public static Transform GetBrother(this Transform transform, string brotherName, bool justContain = true) { return(U_Transform.GetBrother(transform, brotherName, justContain)); }
public static Transform GetChild(this Transform transform, string childName, bool justContain = true) { return(U_Transform.GetChild(transform, childName, justContain)); }
public static Transform GetSon(this Transform transform, string sonName, bool justContain = true) { return(U_Transform.GetSon(transform, sonName, justContain)); }
public static List <Transform> GetBrotherS(this Transform transform, bool isContainSelf = false) { return(U_Transform.GetBrotherS(transform, isContainSelf)); }