Exemplo n.º 1
0
    //曲线版颜色
    public void BeginAccColor(GameObject go, Color from, Color to, float time, AnimationCurve animCurve, int loop, float delayTime, string sign, bool isKeepLive)
    {
        m_maBranch  = MABRANCH.COLOR;
        m_moveGo    = go;
        m_fromColor = from;
        m_toColor   = to;
        m_totalTime = time;
        m_animCurve = animCurve;
        m_totalLoop = loop;
        m_loop      = loop;
        m_sign      = sign;
        IsKeepLive  = isKeepLive;

        Renderer render = m_moveGo.GetComponent <Renderer>();

        if (render != null)
        {
            m_material = render.material;
        }
        m_widget = m_moveGo.GetComponent <Graphic>();

        if (loop > 0)
        {
            Invoke("DelayBegin", delayTime);
        }
        else if (loop < 0)
        {
            InvokeRepeating("DelayBegin", delayTime, time);
        }
    }
Exemplo n.º 2
0
    //曲线版
    public void BeginAcc(MABRANCH maBranch, GameObject go, Vector3 from, Vector3 to, float time, AnimationCurve animCurve, int loop, float delayTime, string sign, bool isKeepLive, bool isRecoverMaterial = false)
    {
        m_maBranch  = maBranch;
        m_totalLoop = loop;
        m_loop      = loop;
        m_sign      = sign;
        IsKeepLive  = isKeepLive;

        switch (m_maBranch)
        {
        case MABRANCH.MOVE:
            m_fromPos = from;
            m_toPos   = to;
            break;

        case MABRANCH.ROTATE:
            m_fromEuler = from;
            m_toEuler   = to;
            break;

        case MABRANCH.SCALE:
            m_fromScale = from;
            m_toScale   = to;
            break;

        case MABRANCH.TRANSPARENT:
            if (m_originalMaterialArray == null && m_originalColor2D == null)
            {
                m_isTransparent = true;
            }
            else    //说明已经储存了材质,这次不用储存,所以m_isTransparent为false
            {
                m_isTransparent = false;
            }
            m_fromA = from.x;
            m_toA   = to.x;
            break;
        }
        SaveAndInitMaterial(go);
        m_isRecoverMaterial = isRecoverMaterial;

        if (m_maBranch == MABRANCH.TRANSPARENT && from.x == -1)
        {
            from = new Vector3(m_fromA, 0, 0);
        }
        m_totalTime = time;
        m_animCurve = animCurve;

        if (loop > 0)
        {
            Invoke("DelayBegin", delayTime);
        }
        else if (loop < 0)
        {
            InvokeRepeating("DelayBegin", delayTime, time);
        }
    }
Exemplo n.º 3
0
 public void BeginAccList(MABRANCH maBranch, GameObject go, Vector3 from, List <Vector3> toList, float time, float speedV, bool isStartV, float delayTime, string sign, bool isKeepLive, bool isRecoverMaterial = false)
 {
     if (toList.Count > 0)
     {
         m_goNext      = 0;
         m_vector3List = toList;
         BeginAcc(maBranch, go, from, toList[m_goNext], time, speedV, isStartV, 1, delayTime, sign, isKeepLive, isRecoverMaterial);
         m_goNext++;
     }
 }
Exemplo n.º 4
0
    public void BeginFixedDecMove(MABRANCH maBranch, GameObject go, Vector3 from, Vector3 to, float delayTime, string sign, bool isKeepLive, bool isRecoverMaterial = false)
    {
        m_maBranch = maBranch;
        m_sign     = sign;
        IsKeepLive = isKeepLive;

        switch (m_maBranch)
        {
        case MABRANCH.MOVE:
            m_fromPos = from;
            m_toPos   = to;
            break;

        case MABRANCH.ROTATE:
            m_fromEuler = from;
            m_toEuler   = to;
            break;

        case MABRANCH.SCALE:
            m_fromScale = from;
            m_toScale   = to;
            break;

        case MABRANCH.TRANSPARENT:
            if (m_originalMaterialArray == null && m_originalColor2D == null)
            {
                m_isTransparent = true;
            }
            else    //说明已经储存了材质,这次不用储存,所以m_isTransparent为false
            {
                m_isTransparent = false;
            }
            m_fromA = from.x;
            m_toA   = to.x;
            break;
        }

        SaveAndInitMaterial(go);

        m_isRecoverMaterial = isRecoverMaterial;

        if (m_maBranch == MABRANCH.TRANSPARENT && from.x == -1)
        {
            from = new Vector3(m_fromA, 0, 0);
        }

        m_accelerated = -2;
        m_endV        = 0;

        m_dis       = Vector3.Distance(from, to);
        m_startV    = Mathf.Sqrt(0 - 2 * m_accelerated * m_dis);
        m_totalTime = (0 - m_startV) / m_accelerated;

        Invoke("DelayBegin", delayTime);
    }
Exemplo n.º 5
0
    //获取第一个相应分支的脚本
    public static MotionAestheticsScrp GetBranchScrp(GameObject go, MABRANCH maBranch)
    {
        MotionAestheticsScrp[] mas = go.GetComponents <MotionAestheticsScrp>();
        foreach (MotionAestheticsScrp ma in mas)
        {
            if (ma.m_maBranch == maBranch)
            {
                return(ma);
            }
        }

        return(null);
    }
Exemplo n.º 6
0
    public static MotionAestheticsScrp[] GetBranchArrayScrp(GameObject go, MABRANCH maBranch)
    {
        List <MotionAestheticsScrp> maList = new List <MotionAestheticsScrp>();

        MotionAestheticsScrp[] mas = go.GetComponents <MotionAestheticsScrp>();
        foreach (MotionAestheticsScrp ma in mas)
        {
            if (ma.m_maBranch == maBranch)
            {
                maList.Add(ma);
            }
        }

        return(maList.ToArray());
    }
Exemplo n.º 7
0
    //函数:开始颜色的加速变化
    public void BeginAccColor(GameObject go, Color from, Color to, float time, float speedV, bool isStartV, int loop, float delayTime, string sign, bool isKeepLive)
    {
        m_maBranch  = MABRANCH.COLOR;
        m_moveGo    = go;
        m_fromColor = from;
        m_toColor   = to;
        m_totalLoop = loop;
        m_loop      = loop;
        m_sign      = sign;
        IsKeepLive  = isKeepLive;

        Renderer render = m_moveGo.GetComponent <Renderer>();

        if (render != null)
        {
            m_material = render.material;
        }
        m_widget = m_moveGo.GetComponent <Graphic>();

        float fromA = m_fromColor.a;
        float toA   = m_toColor.a;

        m_dis       = Vector3.Distance(new Vector3(m_fromColor.r + fromA, m_fromColor.g, m_fromColor.b), new Vector3(m_toColor.r + toA, m_toColor.g, m_toColor.b));
        m_totalTime = time;

        if (isStartV)
        {
            m_startV      = speedV;
            m_accelerated = 2 * (m_dis - m_startV * time) / Mathf.Pow(time, 2);
            m_endV        = m_startV + m_accelerated * time;
        }
        else
        {
            m_endV        = speedV;
            m_accelerated = (2 * m_endV * time - 2 * m_dis) / Mathf.Pow(time, 2);
            m_startV      = m_endV - m_accelerated * time;
        }

        if (loop > 0)
        {
            Invoke("DelayBegin", delayTime);
        }
        else if (loop < 0)
        {
            InvokeRepeating("DelayBegin", delayTime, time);
        }
    }
Exemplo n.º 8
0
    public void BeginAcc(GameObject go, Quaternion from, Quaternion to, float time, AnimationCurve animCurve, int loop, float delayTime, string sign, bool isKeepLive)
    {
        m_maBranch  = MABRANCH.ROTATEQT;
        m_moveGo    = go;
        m_fromQt    = from;
        m_toQt      = to;
        m_totalTime = time;
        m_animCurve = animCurve;
        m_totalLoop = loop;
        m_loop      = loop;
        m_sign      = sign;
        IsKeepLive  = isKeepLive;

        if (loop > 0)
        {
            Invoke("DelayBegin", delayTime);
        }
        else if (loop < 0)
        {
            InvokeRepeating("DelayBegin", delayTime, time);
        }
    }
Exemplo n.º 9
0
    public void BeginAcc(GameObject go, Vector3 axis, float angle, float time, AnimationCurve animCurve, int loop, float delayTime, string sign, bool isKeepLive)
    {
        m_maBranch    = MABRANCH.ROTATEBYAXIS;
        m_moveGo      = go;
        m_axis        = axis;
        m_aroundAngle = 0;
        m_totalAngle  = angle;
        m_totalTime   = time;
        m_animCurve   = animCurve;
        m_totalLoop   = loop;
        m_loop        = loop;
        m_sign        = sign;
        IsKeepLive    = isKeepLive;

        if (loop > 0)
        {
            Invoke("DelayBegin", delayTime);
        }
        else if (loop < 0)
        {
            InvokeRepeating("DelayBegin", delayTime, time);
        }
    }
Exemplo n.º 10
0
    public void BeginAcc(MABRANCH maBranch, GameObject go, Vector3 from, Vector3 to, float time, float speedV, bool isStartV, int loop, float delayTime, string sign, bool isKeepLive, bool isRecoverMaterial = false)
    {
        m_maBranch  = maBranch;
        m_totalLoop = loop;
        m_loop      = loop;
        m_sign      = sign;
        IsKeepLive  = isKeepLive;

        switch (m_maBranch)
        {
        case MABRANCH.MOVE:
            m_fromPos = from;
            m_toPos   = to;
            break;

        case MABRANCH.ROTATE:
            m_fromEuler = from;
            m_toEuler   = to;
            break;

        case MABRANCH.SCALE:
            m_fromScale = from;
            m_toScale   = to;
            break;

        case MABRANCH.TRANSPARENT:
            if (m_originalMaterialArray == null && m_originalColor2D == null)
            {
                m_isTransparent = true;
            }
            else    //说明已经储存了材质,这次不用储存,所以m_isTransparent为false
            {
                m_isTransparent = false;
            }
            m_fromA = from.x;
            m_toA   = to.x;
            break;
        }
        SaveAndInitMaterial(go);
        m_isRecoverMaterial = isRecoverMaterial;

        if (m_maBranch == MABRANCH.TRANSPARENT && from.x == -1)
        {
            from = new Vector3(m_fromA, 0, 0);
        }

        m_dis       = Vector3.Distance(from, to);
        m_totalTime = time;

        if (isStartV)
        {
            m_startV      = speedV;
            m_accelerated = 2 * (m_dis - m_startV * time) / Mathf.Pow(time, 2);
            m_endV        = m_startV + m_accelerated * time;
        }
        else
        {
            m_endV        = speedV;
            m_accelerated = (2 * m_endV * time - 2 * m_dis) / Mathf.Pow(time, 2);
            m_startV      = m_endV - m_accelerated * time;
        }

        if (loop > 0)
        {
            Invoke("DelayBegin", delayTime);
        }
        else if (loop < 0)
        {
            InvokeRepeating("DelayBegin", delayTime, time);
        }
    }