private void classAddSet() { //class created if (this.SCCObjList != null) { int an = this.CTransform.Count - this.SCCObjList.Count; if (an > 0) { for (int i = 0; i < an; i++) { SmoothColliderClass scc = gameObject.AddComponent <SmoothColliderClass>(); #if UNITY_EDITOR Undo.RegisterCreatedObjectUndo(scc, "Created SJ Class"); #endif if (scc != null) { scc.SJCCNumber = i; if (this.CTransform[i] != null) { scc.SJCCTransform = this.CTransform[i].transform; scc.SJCCTransform.name = this.CTransform[i].transform.name; } if (this.Radius != null) { scc.SJCCRadius = this.Radius[i]; } this.SCCObjList.Add(scc); } } } } }
private void colliderAddSet(bool ss, int sn) { //collider created if (this.CTransform != null) { if (ss == false) { //Initialization for (int i = 0; i < this.SJColliderNumber; i++) { GameObject go = new GameObject("Please click a ColliderAutoSetOn (SmoothJoint Component)"); #if UNITY_EDITOR Undo.RegisterCreatedObjectUndo(go, "Created SJ Collider"); #endif if (go != null) { this.CTransform.Add(go); this.CTransform[i].transform.parent = this.ParentObject.transform; this.CTransform[i].transform.localPosition = this.Center[i]; this.CTransform[i].transform.localRotation = Quaternion.identity; this.CTransform[i].transform.localScale = new Vector3(1f, 1f, 1f); if (this.SCCObjList != null) { SmoothColliderClass scc = gameObject.AddComponent <SmoothColliderClass>(); #if UNITY_EDITOR Undo.RegisterCreatedObjectUndo(scc, "Created SJ Class"); #endif if (scc != null) { scc.SJCCNumber = i; scc.SJCCTransform = this.CTransform[i].transform; scc.SJCCTransform.name = this.CTransform[i].transform.name; if (this.Radius != null) { scc.SJCCRadius = this.Radius[i]; } this.SCCObjList.Add(scc); } } } } } else { //add to for (int si = sn; si < this.SJColliderNumber; si++) { GameObject go = new GameObject("Please click a ColliderAutoSetOn (SmoothJoint Component)"); #if UNITY_EDITOR Undo.RegisterCreatedObjectUndo(go, "Created SJ Collider"); #endif if (go != null) { this.CTransform.Add(go); this.CTransform[si].transform.parent = this.ParentObject.transform; this.ReSetRadius(); this.ReSetCenter(); this.CTransform[si].transform.localPosition = this.Center[si]; this.CTransform[si].transform.localRotation = Quaternion.identity; this.CTransform[si].transform.localScale = new Vector3(1f, 1f, 1f); if (this.SCCObjList != null) { SmoothColliderClass scc = gameObject.AddComponent <SmoothColliderClass>(); #if UNITY_EDITOR Undo.RegisterCreatedObjectUndo(scc, "Created SJ Class"); #endif if (scc != null) { scc.SJCCNumber = si - sn; scc.SJCCTransform = this.CTransform[si].transform; scc.SJCCTransform.name = this.CTransform[si].transform.name; if (this.Radius != null) { scc.SJCCRadius = this.Radius[si]; } this.SCCObjList.Add(scc); } } } } } } Debug.Log("Add a SmoothCollider: Total " + this.CTransform.Count); }