void DrawAnimation(int index) { if (index < 0 || index >= this.animation.animations.Count) { return; } EditorGUILayout.Space(); GUILayout.BeginHorizontal(); { EditorGUI.BeginChangeCheck(); AnimationPattern newPattern = EditorGUILayout.ObjectField(this.animation.animations[index].pattern, typeof(AnimationPattern), false, GUILayout.MinWidth(100)) as AnimationPattern; AnimationFX newAnimation = EditorGUILayout.ObjectField(this.animation.animations[index].animation, typeof(AnimationFX), false, GUILayout.MinWidth(100)) as AnimationFX; float newLife = EditorGUILayout.FloatField(this.animation.animations[index].life, GUILayout.MinWidth(15)); float newDelay = EditorGUILayout.FloatField(this.animation.animations[index].delay, GUILayout.MinWidth(15)); if (newLife < 0) { newLife = 0; } if (newDelay < 0) { newDelay = 0; } if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(this.animation, "Undo Inspector (Complex Animation)"); this.animation.animations[index].pattern = newPattern; this.animation.animations[index].animation = newAnimation; this.animation.animations[index].delay = newDelay; this.animation.animations[index].life = newLife; EditorUtility.SetDirty(this.animation); } /* * if (GUILayout.Button("Preview")) * { * if (this.animation.animations[index].pattern) * Debug.Log("Preview of pattern " + this.animation.animations[index].pattern.patternName); * else * Debug.LogWarning("Pattern is missing"); * } */ if (GUILayout.Button("X")) { Undo.RecordObject(this.animation, "Undo Inspector (Complex Animation)"); this.animation.animations.RemoveAt(index); EditorUtility.SetDirty(this.animation); } } GUILayout.EndHorizontal(); }
private void Start() { #region Singleton if (Instance == null) { Instance = this; } else { Destroy(gameObject); } #endregion }
public void Instantiation(AnimationPattern pattern, AnimationFX fx) { this.pattern = pattern; this.fx = fx; }