示例#1
0
    // Update is called once per frame

    void Update()
    {
        if (coolDown != 0 && tag == nameGoodPixel)
        {
            coolDown -= Time.deltaTime;
            if (coolDown < 0)
            {
                coolDown = 0;
            }
        }
        List <Lerp> toRemove     = new List <Lerp>();
        bool        addTransform = false;

        foreach (var item in lerpList)
        {
            item.addTime(Time.deltaTime);
            Lerp.LerpResult result = item.lerp();
            if (result != Lerp.LerpResult.NOTFINISHED)
            {
                if (life <= 0 && item.animationType == Lerp.AnimationType.DAMAGE)
                {
                    addTransform = true;
                }
                toRemove.Add(item);
                if (result == Lerp.LerpResult.DELETEDAMAGEANIMATIONINSTANCE)
                {
                    lerpDamageInstance = null;
                }
                if (result == Lerp.LerpResult.DELETEBACKGROUNDANIMATIONINSTANCE)
                {
                    lerpBackgroundInstance = null;
                }
                if (result == Lerp.LerpResult.IMMEDIATEATTACK)
                {
                    //coolDown = 0;
                }
            }
        }
        foreach (var item in toRemove)
        {
            lerpList.Remove(item);
        }
        if (addTransform)
        {
            if (!transformtriggered)
            {
                triggerTransformAnimation();
            }
        }
    }
示例#2
0
    public void manageLerp()
    {
        if (lerpList.Count != 0)
        {
            List <Lerp>            toRemove = new List <Lerp>();
            List <Lerp.LerpResult> results  = new List <Lerp.LerpResult>();

            foreach (var item in lerpList)
            {
                item.addTime(Time.deltaTime);
                Lerp.LerpResult result = item.lerp();
                if (result != Lerp.LerpResult.NOTFINISHED)
                {
                    toRemove.Add(item);
                    results.Add(result);
                }
            }
            foreach (var item in toRemove)
            {
                lerpList.Remove(item);
            }
            handleLerpResults(results);
        }
    }