Пример #1
0
    public float GetDelay(string name)
    {
        BumpData bd = null;

        for (int i = 0; i < _datas.Count; i++)
        {
            if (_datas[i].name.Equals(name))
            {
                bd = _datas[i];
            }
        }

        return(UnityEngine.Random.Range(bd._delay.x, bd._delay.y));
    }
Пример #2
0
    public float GetStrength(string name)
    {
        BumpData bd = null;

        for (int i = 0; i < _datas.Count; i++)
        {
            if (_datas[i].name == name)
            {
                bd = _datas[i];
            }
        }

        return(UnityEngine.Random.Range(bd._strengthRange.x, bd._strengthRange.y));
    }
Пример #3
0
    public Vector2 Anim(out bool isFinish, float startTime, float strength, float delay, string name)
    {
        BumpData bd = null;

        for (int i = 0; i < _datas.Count; i++)
        {
            if (_datas[i].name.Equals(name))
            {
                bd = _datas[i];
            }
        }

        float dt = Time.time - startTime;

        if (dt < delay)
        {
            isFinish = false;
            return(Vector2.zero);
        }

        dt -= delay;

        float nt = dt / bd._duration;

        if (nt > 1)
        {
            nt       = 1;
            isFinish = true;
        }
        else
        {
            isFinish = false;
        }

        float ctx = bd._curveX.Evaluate(nt);
        float cty = bd._curveY.Evaluate(nt);

        float x = Mathf.LerpUnclamped(0, strength, ctx);
        float y = Mathf.LerpUnclamped(0, Mathf.Abs(strength * bd._scaleY), cty);

        return(new Vector2(x, y));
    }