Beispiel #1
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            ReprModel myScript = (ReprModel)target;

            if (GUILayout.Button("AWAKE CHILDREN REPRMODELS"))
            {
                Debug.Log("Awaking children models...");

                ReprModel[] childrenModels = myScript.transform.GetComponentsInChildren <ReprModel>();

                for (int c = 0; c < childrenModels.Length; c++)
                {
                    if (childrenModels[c] == myScript)
                    {
                        continue;
                    }

                    childrenModels[c].Awake();
                }

                Debug.Log("Done");
            }
        }
Beispiel #2
0
 public Vector3 GetWorldFromLocalPoition(Vector3 newLocalPos, ReprModel repr)
 {
     if (!repr.parent || !repr.relativeToParentBone)
     {
         return(repr.transformRef.parent.TransformPoint(newLocalPos));
     }
     return(repr.parent.transformRef.TransformPoint(newLocalPos));
 }
Beispiel #3
0
 public Vector3 GetLocalPosition(ReprModel repr)
 {
     if (!repr.parent || !repr.relativeToParentBone)
     {
         return(repr.transformRef.localPosition);
     }
     return(repr.parent.transformRef.InverseTransformPoint(repr.transformRef.position));
 }
Beispiel #4
0
 public Quaternion GetWorldFromLocalRotation(Quaternion newLocalRot, ReprModel repr)
 {
     if (!repr.parent || !repr.relativeToParentBone)
     {
         return(repr.transformRef.parent.rotation * newLocalRot);
     }
     return(repr.parent.transformRef.rotation * newLocalRot);
 }
Beispiel #5
0
 public Quaternion GetLocalRotation(ReprModel repr)
 {
     if (!repr.parent || !repr.relativeToParentBone)
     {
         return(repr.transformRef.localRotation);
     }
     return(Quaternion.Inverse(repr.parent.transformRef.rotation) * repr.transformRef.rotation);
 }
Beispiel #6
0
 public SerializableRepr(KeyValuePair <string, ReprModel> pair)
 {
     key  = pair.Key;
     repr = pair.Value;
 }
Beispiel #7
0
 public override sealed void Awake()
 {
     base.Awake();
     model = GetComponent <ReprModel>();
 }