public override void OnInspectorGUI() { MegaPointCacheRef am = (MegaPointCacheRef)target; // Basic mod stuff showmodparams = EditorGUILayout.Foldout(showmodparams, "Modifier Common Params"); if (showmodparams) { CommonModParamsBasic(am); } am.source = (MegaPointCache)EditorGUILayout.ObjectField("Source", am.source, typeof(MegaPointCache), true); am.time = EditorGUILayout.FloatField("Time", am.time); am.maxtime = EditorGUILayout.FloatField("Loop Time", am.maxtime); am.animated = EditorGUILayout.Toggle("Animated", am.animated); am.speed = EditorGUILayout.FloatField("Speed", am.speed); am.LoopMode = (MegaRepeatMode)EditorGUILayout.EnumPopup("Loop Mode", am.LoopMode); am.interpMethod = (MegaInterpMethod)EditorGUILayout.EnumPopup("Interp Method", am.interpMethod); am.blendMode = (MegaBlendAnimMode)EditorGUILayout.EnumPopup("Blend Mode", am.blendMode); if (am.blendMode == MegaBlendAnimMode.Additive) { am.weight = EditorGUILayout.FloatField("Weight", am.weight); } if (GUI.changed) { EditorUtility.SetDirty(target); } }
void DoUpdate() { if (mod == null && modref == null) { mod = (MegaPointCache)GetComponent <MegaPointCache>(); modref = (MegaPointCacheRef)GetComponent <MegaPointCacheRef>(); } if (mod != null || modref != null) { if (LinkedUpdate) { DoLinkedUpdate(); } else { if (clips.Count > 0 && current < clips.Count) { if (t >= 0.0f) { t += Time.deltaTime * clips[current].speed; float dt = clips[current].end - clips[current].start; switch (clips[current].loop) { //case MegaRepeatMode.Loop: at = Mathf.Repeat(t, dt); break; case MegaRepeatMode.Loop: at = Mathf.Repeat(t, Mathf.Abs(dt)); if (dt < 0.0f) { at = clips[current].start - at; } break; case MegaRepeatMode.PingPong: at = Mathf.PingPong(t, dt); break; case MegaRepeatMode.Clamp: at = Mathf.Clamp(t, 0.0f, dt); break; } at += clips[current].start; if (mod) { mod.SetAnim(at); } else { modref.SetAnim(at); } } } } } }
void DoUpdate() { if ( mod == null && modref == null ) { mod = (MegaPointCache)GetComponent<MegaPointCache>(); modref = (MegaPointCacheRef)GetComponent<MegaPointCacheRef>(); } if ( mod != null || modref != null ) { if ( LinkedUpdate ) { DoLinkedUpdate(); } else { if ( clips.Count > 0 && current < clips.Count ) { if ( t >= 0.0f ) { t += Time.deltaTime * clips[current].speed; float dt = clips[current].end - clips[current].start; switch ( clips[current].loop ) { //case MegaRepeatMode.Loop: at = Mathf.Repeat(t, dt); break; case MegaRepeatMode.Loop: at = Mathf.Repeat(t, Mathf.Abs(dt)); if ( dt < 0.0f ) at = clips[current].start - at; break; case MegaRepeatMode.PingPong: at = Mathf.PingPong(t, dt); break; case MegaRepeatMode.Clamp: at = Mathf.Clamp(t, 0.0f, dt); break; } at += clips[current].start; if ( mod ) mod.SetAnim(at); else modref.SetAnim(at); } } } } }