Ejemplo n.º 1
0
    public static AnimateScale Do(GameObject sub, EZAnimation.ANIM_MODE mode, bool increase, Vector3 begin, Vector3 dest, Vector3 beginPos, Vector3 destPos, EZAnimation.Interpolator interp, float dur, float delay, EZAnimation.CompletionDelegate startDel, EZAnimation.CompletionDelegate del)
    {
        AnimateScale animateScale = (AnimateScale)EZAnimator.instance.GetAnimation(EZAnimation.ANIM_TYPE.Scale);

        animateScale.Start(sub, mode, increase, begin, dest, beginPos, destPos, interp, dur, delay, startDel, del);
        return(animateScale);
    }
    public static FadeText Do(SpriteText txt, EZAnimation.ANIM_MODE mode, Color dest, EZAnimation.Interpolator interp, float dur, float delay, EZAnimation.CompletionDelegate startDel, EZAnimation.CompletionDelegate del)
    {
        FadeText fadeText = (FadeText)EZAnimator.instance.GetAnimation(EZAnimation.ANIM_TYPE.FadeText);

        fadeText.Start(txt, mode, dest, interp, dur, delay, startDel, del);
        return(fadeText);
    }
 public void Start(SpriteRoot sprt, EZAnimation.ANIM_MODE mode, Color begin, Color dest, EZAnimation.Interpolator interp, float dur, float delay, EZAnimation.CompletionDelegate startDel, EZAnimation.CompletionDelegate del)
 {
     this.sprite = sprt;
     this.start  = begin;
     this.m_mode = mode;
     if (mode == EZAnimation.ANIM_MODE.By)
     {
         this.delta = dest;
     }
     else
     {
         this.delta = new Color(dest.r - this.start.r, dest.g - this.start.g, dest.b - this.start.b, dest.a - this.start.a);
     }
     this.end               = this.start + this.delta;
     this.interpolator      = interp;
     this.duration          = dur;
     this.m_wait            = delay;
     this.completedDelegate = del;
     this.startDelegate     = startDel;
     base.StartCommon();
     if (mode == EZAnimation.ANIM_MODE.FromTo && delay == 0f)
     {
         this.sprite.SetColor(this.start);
     }
     EZAnimator.instance.AddAnimation(this);
 }
    public static FadeSprite Do(SpriteRoot sprt, EZAnimation.ANIM_MODE mode, Color dest, EZAnimation.Interpolator interp, float dur, float delay, EZAnimation.CompletionDelegate startDel, EZAnimation.CompletionDelegate del)
    {
        FadeSprite fadeSprite = (FadeSprite)EZAnimator.instance.GetAnimation(EZAnimation.ANIM_TYPE.FadeSprite);

        fadeSprite.Start(sprt, mode, dest, interp, dur, delay, startDel, del);
        return(fadeSprite);
    }
Ejemplo n.º 5
0
    public static FadeMaterial Do(Material material, EZAnimation.ANIM_MODE mode, Color dest, EZAnimation.Interpolator interp, float dur, float delay, EZAnimation.CompletionDelegate startDel, EZAnimation.CompletionDelegate del)
    {
        FadeMaterial fadeMaterial = (FadeMaterial)EZAnimator.instance.GetAnimation(EZAnimation.ANIM_TYPE.FadeMaterial);

        fadeMaterial.Start(material, mode, dest, interp, dur, delay, startDel, del);
        return(fadeMaterial);
    }
Ejemplo n.º 6
0
 public void Start(GameObject sub, EZAnimation.ANIM_MODE mode, float width, float height, Vector3 begin, Vector3 dest, EZAnimation.Interpolator interp, float dur, float delay, EZAnimation.CompletionDelegate startDel, EZAnimation.CompletionDelegate del)
 {
     this.startWidth  = width;
     this.startHeight = height;
     this.movePos     = false;
     this.subject     = sub;
     this.subTrans    = this.subject.transform;
     this.start       = begin;
     this.m_mode      = mode;
     if (mode == EZAnimation.ANIM_MODE.By)
     {
         this.delta = Vector3.Scale(this.start, dest) - this.start;
     }
     else
     {
         this.delta = dest - this.start;
     }
     this.startPos          = this.subject.transform.localPosition;
     this.deltaPos          = this.subject.transform.localPosition;
     this.end               = this.start + this.delta;
     this.interpolator      = interp;
     this.duration          = dur;
     this.m_wait            = delay;
     this.completedDelegate = del;
     this.startDelegate     = startDel;
     base.StartCommon();
     if (mode == EZAnimation.ANIM_MODE.FromTo && delay == 0f)
     {
         this.subTrans.localScale = this.start;
     }
     EZAnimator.instance.AddAnimation(this);
 }
Ejemplo n.º 7
0
    public static AnimateRotation Do(GameObject sub, EZAnimation.ANIM_MODE mode, Vector3 dest, EZAnimation.Interpolator interp, float dur, float delay, EZAnimation.CompletionDelegate startDel, EZAnimation.CompletionDelegate del)
    {
        AnimateRotation animateRotation = (AnimateRotation)EZAnimator.instance.GetAnimation(EZAnimation.ANIM_TYPE.Rotate);

        animateRotation.Start(sub, mode, dest, interp, dur, delay, startDel, del);
        return(animateRotation);
    }
    public static FadeAudio Do(AudioSource audio, EZAnimation.ANIM_MODE mode, float begin, float dest, EZAnimation.Interpolator interp, float dur, float delay, EZAnimation.CompletionDelegate startDel, EZAnimation.CompletionDelegate del)
    {
        FadeAudio fadeAudio = (FadeAudio)EZAnimator.instance.GetAnimation(EZAnimation.ANIM_TYPE.FadeAudio);

        fadeAudio.Start(audio, mode, begin, dest, interp, dur, delay, startDel, del);
        return(fadeAudio);
    }
Ejemplo n.º 9
0
 public void Start(GameObject sub, EZAnimation.ANIM_MODE mode, Vector3 begin, Vector3 dest, EZAnimation.Interpolator interp, float dur, float delay, EZAnimation.CompletionDelegate startDel, EZAnimation.CompletionDelegate del)
 {
     this.subject  = sub;
     this.subTrans = this.subject.transform;
     this.start    = begin;
     this.m_mode   = mode;
     if (mode == EZAnimation.ANIM_MODE.By)
     {
         this.delta = dest;
     }
     else
     {
         this.delta = new Vector3(dest.x - this.start.x, dest.y - this.start.y, dest.z - this.start.z);
     }
     this.end               = this.start + this.delta;
     this.interpolator      = interp;
     this.duration          = dur;
     this.m_wait            = delay;
     this.completedDelegate = del;
     this.startDelegate     = startDel;
     base.StartCommon();
     if (mode == EZAnimation.ANIM_MODE.FromTo && delay == 0f)
     {
         this.subTrans.localEulerAngles = this.start;
     }
     EZAnimator.instance.AddAnimation(this);
 }
    public static TuneAudio Do(AudioSource audio, EZAnimation.ANIM_MODE mode, float dest, EZAnimation.Interpolator interp, float dur, float delay, EZAnimation.CompletionDelegate startDel, EZAnimation.CompletionDelegate del)
    {
        TuneAudio tuneAudio = (TuneAudio)EZAnimator.instance.GetAnimation(EZAnimation.ANIM_TYPE.TuneAudio);

        tuneAudio.Start(audio, mode, dest, interp, dur, delay, startDel, del);
        return(tuneAudio);
    }
 public void Start(AudioSource sub, EZAnimation.ANIM_MODE mode, float begin, float dest, EZAnimation.Interpolator interp, float dur, float delay, EZAnimation.CompletionDelegate startDel, EZAnimation.CompletionDelegate del)
 {
     this.subject = sub;
     this.start   = begin;
     this.m_mode  = mode;
     if (mode == EZAnimation.ANIM_MODE.By)
     {
         this.delta = dest;
     }
     else
     {
         this.delta = dest - this.start;
     }
     this.end               = this.start + this.delta;
     this.interpolator      = interp;
     this.duration          = dur;
     this.m_wait            = delay;
     this.completedDelegate = del;
     this.startDelegate     = startDel;
     base.StartCommon();
     EZAnimator.instance.Stop(this.subject, this.type, mode == EZAnimation.ANIM_MODE.By);
     if (mode == EZAnimation.ANIM_MODE.FromTo && delay == 0f)
     {
         this.subject.pitch = this.start;
     }
     EZAnimator.instance.AddAnimation(this);
 }
Ejemplo n.º 12
0
 public void Start(GameObject sub, EZAnimation.ANIM_MODE mode, Vector3 dest, EZAnimation.Interpolator interp, float dur, float delay, EZAnimation.CompletionDelegate startDel, EZAnimation.CompletionDelegate del)
 {
     if (sub == null)
     {
         return;
     }
     this.Start(sub, mode, sub.transform.localEulerAngles, dest, interp, dur, delay, startDel, del);
 }
Ejemplo n.º 13
0
 public void Copy(AnimParams src)
 {
     this.mode            = src.mode;
     this.delay           = src.delay;
     this.duration        = src.duration;
     this.easing          = src.easing;
     this.color           = src.color;
     this.vec             = src.vec;
     this.axis            = src.axis;
     this.floatVal        = src.floatVal;
     this.color2          = src.color2;
     this.vec2            = src.vec2;
     this.floatVal2       = src.floatVal2;
     this.strVal          = src.strVal;
     this.pingPong        = src.pingPong;
     this.repeatDelay     = src.repeatDelay;
     this.restartOnRepeat = src.restartOnRepeat;
 }
Ejemplo n.º 14
0
    public virtual void DrawGUI(EZAnimation.ANIM_TYPE type, GameObject go, IGUIHelper gui, bool inspector)
    {
        float pixels  = 0f;
        float pixels2 = 0f;
        bool  changed = GUI.changed;

        GUI.changed = false;
        this.delay  = gui.FloatField("Delay:", this.delay);
        if (!inspector)
        {
            GUILayout.Space(pixels);
        }
        this.duration = gui.FloatField("Duration:", this.duration);
        if (this.duration < 0f)
        {
            this.repeatDelay = GUILayout.Toggle(this.repeatDelay, new GUIContent("Rep. Delay", "Repeats the delay on each loop iteration"), new GUILayoutOption[0]);
            if (type != EZAnimation.ANIM_TYPE.AnimClip || type != EZAnimation.ANIM_TYPE.Crash || type != EZAnimation.ANIM_TYPE.CrashRotation || type != EZAnimation.ANIM_TYPE.PunchPosition || type != EZAnimation.ANIM_TYPE.PunchRotation || type != EZAnimation.ANIM_TYPE.PunchScale || type != EZAnimation.ANIM_TYPE.Shake || type != EZAnimation.ANIM_TYPE.ShakeRotation || type != EZAnimation.ANIM_TYPE.SmoothCrash)
            {
                this.pingPong = GUILayout.Toggle(this.pingPong, new GUIContent("PingPong", "Ping-Pong: Causes the animated value to go back and forth as it loops."), new GUILayoutOption[0]);
            }
        }
        if (!inspector)
        {
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Space(pixels2);
        }
        if (type == EZAnimation.ANIM_TYPE.FadeMaterial || type == EZAnimation.ANIM_TYPE.FadeSprite || type == EZAnimation.ANIM_TYPE.FadeAudio || type == EZAnimation.ANIM_TYPE.TuneAudio || type == EZAnimation.ANIM_TYPE.FadeText || type == EZAnimation.ANIM_TYPE.Rotate || type == EZAnimation.ANIM_TYPE.Scale || type == EZAnimation.ANIM_TYPE.Translate)
        {
            this.easing = (EZAnimation.EASING_TYPE)gui.EnumField("Easing:", this.easing);
        }
        if (!inspector)
        {
            GUILayout.Space(pixels);
        }
        if (type == EZAnimation.ANIM_TYPE.FadeMaterial || type == EZAnimation.ANIM_TYPE.FadeSprite || type == EZAnimation.ANIM_TYPE.FadeAudio || type == EZAnimation.ANIM_TYPE.TuneAudio || type == EZAnimation.ANIM_TYPE.FadeText || type == EZAnimation.ANIM_TYPE.Rotate || type == EZAnimation.ANIM_TYPE.Scale || type == EZAnimation.ANIM_TYPE.Translate)
        {
            this.mode = (EZAnimation.ANIM_MODE)gui.EnumField("Mode:", this.mode);
        }
        if (this.duration < 0f && (type == EZAnimation.ANIM_TYPE.FadeMaterial || type == EZAnimation.ANIM_TYPE.FadeSprite || type == EZAnimation.ANIM_TYPE.FadeAudio || type == EZAnimation.ANIM_TYPE.TuneAudio || type == EZAnimation.ANIM_TYPE.FadeText || type == EZAnimation.ANIM_TYPE.Rotate || type == EZAnimation.ANIM_TYPE.Scale || type == EZAnimation.ANIM_TYPE.Translate))
        {
            this.restartOnRepeat = GUILayout.Toggle(this.restartOnRepeat, new GUIContent("Restart on Loop", "Resets the starting value on each loop iteration. Set this to false if you want something like continuous movement in the same direction without going back to the starting point."), new GUILayoutOption[0]);
        }
        if (!inspector)
        {
            GUILayout.EndHorizontal();
        }
        switch (type)
        {
        case EZAnimation.ANIM_TYPE.AnimClip:
            this.strVal = gui.TextField("Anim Clip:", this.strVal);
            if (!inspector)
            {
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                this.floatVal = Mathf.Clamp01(gui.FloatField("Blend Weight:", this.floatVal));
                GUILayout.Space(15f);
                this.floatVal = GUILayout.HorizontalSlider(this.floatVal, 0f, 1f, new GUILayoutOption[]
                {
                    GUILayout.Width(200f)
                });
                GUILayout.EndHorizontal();
            }
            else
            {
                this.floatVal = Mathf.Clamp01(gui.FloatField("Blend Weight:", this.floatVal));
            }
            break;

        case EZAnimation.ANIM_TYPE.FadeSprite:
        case EZAnimation.ANIM_TYPE.FadeMaterial:
        case EZAnimation.ANIM_TYPE.FadeText:
            if (this.mode == EZAnimation.ANIM_MODE.FromTo)
            {
                this.color  = gui.ColorField("Start Color:", this.color);
                this.color2 = gui.ColorField("End Color:", this.color2);
            }
            else
            {
                this.color = gui.ColorField("Color:", this.color);
            }
            break;

        case EZAnimation.ANIM_TYPE.Translate:
            if (this.mode == EZAnimation.ANIM_MODE.FromTo)
            {
                this.vec = gui.Vector3Field("Start Pos:", this.vec);
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                if (GUILayout.Button(new GUIContent("Use Current", "Uses the object's current value for this field"), new GUILayoutOption[0]))
                {
                    this.vec    = go.transform.localPosition;
                    GUI.changed = true;
                }
                if (GUILayout.Button(new GUIContent("Set as Current", "Applies the displayed values to the current object."), new GUILayoutOption[0]))
                {
                    go.transform.localPosition = this.vec;
                }
                GUILayout.EndHorizontal();
                this.vec2 = gui.Vector3Field("End Pos:", this.vec2);
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                if (GUILayout.Button(new GUIContent("Use Current", "Uses the object's current value for this field"), new GUILayoutOption[0]))
                {
                    this.vec2   = go.transform.localPosition;
                    GUI.changed = true;
                }
                if (GUILayout.Button(new GUIContent("Set as Current", "Applies the displayed values to the current object."), new GUILayoutOption[0]))
                {
                    go.transform.localPosition = this.vec2;
                }
                GUILayout.EndHorizontal();
            }
            else if (this.mode == EZAnimation.ANIM_MODE.By)
            {
                this.vec = gui.Vector3Field("Vector:", this.vec);
            }
            else
            {
                this.vec = gui.Vector3Field("Pos:", this.vec);
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                if (GUILayout.Button(new GUIContent("Use Current", "Uses the object's current value for this field"), new GUILayoutOption[0]))
                {
                    this.vec    = go.transform.localPosition;
                    GUI.changed = true;
                }
                if (GUILayout.Button(new GUIContent("Set as Current", "Applies the displayed values to the current object."), new GUILayoutOption[0]))
                {
                    go.transform.localPosition = this.vec;
                }
                GUILayout.EndHorizontal();
            }
            break;

        case EZAnimation.ANIM_TYPE.PunchPosition:
        case EZAnimation.ANIM_TYPE.Crash:
        case EZAnimation.ANIM_TYPE.PunchScale:
        case EZAnimation.ANIM_TYPE.PunchRotation:
            this.vec = gui.Vector3Field("Magnitude:", this.vec);
            break;

        case EZAnimation.ANIM_TYPE.SmoothCrash:
        case EZAnimation.ANIM_TYPE.CrashRotation:
            this.vec  = gui.Vector3Field("Magnitude:", this.vec);
            this.vec2 = gui.Vector3Field("Oscillations:", this.vec2);
            break;

        case EZAnimation.ANIM_TYPE.Shake:
        case EZAnimation.ANIM_TYPE.ShakeRotation:
            this.vec      = gui.Vector3Field("Magnitude:", this.vec);
            this.floatVal = gui.FloatField("Oscillations:", this.floatVal);
            break;

        case EZAnimation.ANIM_TYPE.Scale:
            if (this.mode == EZAnimation.ANIM_MODE.FromTo)
            {
                this.vec = gui.Vector3Field("Start Scale:", this.vec);
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                if (GUILayout.Button(new GUIContent("Use Current", "Uses the object's current value for this field"), new GUILayoutOption[0]))
                {
                    this.vec    = go.transform.localScale;
                    GUI.changed = true;
                }
                if (GUILayout.Button(new GUIContent("Set as Current", "Applies the displayed values to the current object."), new GUILayoutOption[0]))
                {
                    go.transform.localScale = this.vec;
                }
                GUILayout.EndHorizontal();
                this.vec2 = gui.Vector3Field("End Scale:", this.vec2);
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                if (GUILayout.Button(new GUIContent("Use Current", "Uses the object's current value for this field"), new GUILayoutOption[0]))
                {
                    this.vec2   = go.transform.localScale;
                    GUI.changed = true;
                }
                if (GUILayout.Button(new GUIContent("Set as Current", "Applies the displayed values to the current object."), new GUILayoutOption[0]))
                {
                    go.transform.localScale = this.vec2;
                }
                GUILayout.EndHorizontal();
            }
            else
            {
                this.vec = gui.Vector3Field("Scale:", this.vec);
                if (this.mode == EZAnimation.ANIM_MODE.To)
                {
                    GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                    if (GUILayout.Button(new GUIContent("Use Current", "Uses the object's current value for this field"), new GUILayoutOption[0]))
                    {
                        this.vec    = go.transform.localScale;
                        GUI.changed = true;
                    }
                    if (GUILayout.Button(new GUIContent("Set as Current", "Applies the displayed values to the current object."), new GUILayoutOption[0]))
                    {
                        go.transform.localScale = this.vec;
                    }
                    GUILayout.EndHorizontal();
                }
            }
            break;

        case EZAnimation.ANIM_TYPE.Rotate:
            if (this.mode == EZAnimation.ANIM_MODE.FromTo)
            {
                this.vec = gui.Vector3Field("Start Angles:", this.vec);
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                if (GUILayout.Button(new GUIContent("Use Current", "Uses the object's current value for this field"), new GUILayoutOption[0]))
                {
                    this.vec    = go.transform.localEulerAngles;
                    GUI.changed = true;
                }
                if (GUILayout.Button(new GUIContent("Set as Current", "Applies the displayed values to the current object."), new GUILayoutOption[0]))
                {
                    go.transform.localEulerAngles = this.vec;
                }
                GUILayout.EndHorizontal();
                this.vec2 = gui.Vector3Field("End Angles:", this.vec2);
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                if (GUILayout.Button(new GUIContent("Use Current", "Uses the object's current value for this field"), new GUILayoutOption[0]))
                {
                    this.vec2   = go.transform.localEulerAngles;
                    GUI.changed = true;
                }
                if (GUILayout.Button(new GUIContent("Set as Current", "Applies the displayed values to the current object."), new GUILayoutOption[0]))
                {
                    go.transform.localEulerAngles = this.vec2;
                }
                GUILayout.EndHorizontal();
            }
            else
            {
                this.vec = gui.Vector3Field("Angles:", this.vec);
                if (this.mode == EZAnimation.ANIM_MODE.To)
                {
                    GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                    if (GUILayout.Button(new GUIContent("Use Current", "Uses the object's current value for this field"), new GUILayoutOption[0]))
                    {
                        this.vec    = go.transform.localEulerAngles;
                        GUI.changed = true;
                    }
                    if (GUILayout.Button(new GUIContent("Set as Current", "Applies the displayed values to the current object."), new GUILayoutOption[0]))
                    {
                        go.transform.localEulerAngles = this.vec;
                    }
                    GUILayout.EndHorizontal();
                }
            }
            break;

        case EZAnimation.ANIM_TYPE.FadeAudio:
            if (this.mode == EZAnimation.ANIM_MODE.FromTo)
            {
                this.floatVal  = gui.FloatField("Start Volume:", this.floatVal);
                this.floatVal2 = gui.FloatField("End Volume:", this.floatVal2);
            }
            else
            {
                this.floatVal = gui.FloatField("Volume:", this.floatVal);
            }
            break;

        case EZAnimation.ANIM_TYPE.TuneAudio:
            if (this.mode == EZAnimation.ANIM_MODE.FromTo)
            {
                this.floatVal  = gui.FloatField("Start pitch:", this.floatVal);
                this.floatVal2 = gui.FloatField("End pitch:", this.floatVal2);
            }
            else
            {
                this.floatVal = gui.FloatField("Pitch:", this.floatVal);
            }
            break;
        }
        if (GUI.changed)
        {
            this.m_transition.initialized = true;
        }
        GUI.changed = (changed || GUI.changed);
    }
 public void Start(SpriteRoot sprt, EZAnimation.ANIM_MODE mode, Color dest, EZAnimation.Interpolator interp, float dur, float delay, EZAnimation.CompletionDelegate startDel, EZAnimation.CompletionDelegate del)
 {
     this.Start(sprt, mode, sprt.color, dest, interp, dur, delay, startDel, del);
 }
Ejemplo n.º 16
0
 public void Start(Material material, EZAnimation.ANIM_MODE mode, Color dest, EZAnimation.Interpolator interp, float dur, float delay, EZAnimation.CompletionDelegate startDel, EZAnimation.CompletionDelegate del)
 {
     this.Start(material, mode, material.color, dest, interp, dur, delay, startDel, del);
 }
 public void Start(AudioSource audio, EZAnimation.ANIM_MODE mode, float dest, EZAnimation.Interpolator interp, float dur, float delay, EZAnimation.CompletionDelegate startDel, EZAnimation.CompletionDelegate del)
 {
     this.Start(audio, mode, audio.pitch, dest, interp, dur, delay, startDel, del);
 }