Example #1
0
    private bool ScaleLine(EffectLine line, Transform curLine, Dir dirOfParticle, float length)
    {
        float distCovered = (Time.time - line.timer) * line.speed;
        float dt          = distCovered / length;

        float scaleValue = Mathf.Lerp(0, 1, dt);

        scaleValue = Mathf.Min(scaleValue, 1);

        curLine.localScale = new Vector3(scaleValue, 1, 1);

        Vector3 pos = curLine.transform.localPosition;

        if (dirOfParticle == Dir.Up)
        {
            pos.y = curLine.localPosition.y + scaleValue * length;
        }
        if (dirOfParticle == Dir.Left)
        {
            pos.x = curLine.localPosition.x - scaleValue * length;
        }
        if (dirOfParticle == Dir.Right)
        {
            pos.x = curLine.localPosition.x + scaleValue * length;
        }

        line.particle.transform.localPosition = pos;

        if (scaleValue == 1)
        {
            return(false);
        }
        return(true);
    }
Example #2
0
        public EffectLine CreateEffectLineUI(int effectType)
        {
            //string effectname = EffectHelper.GetEffectName(effectType);
            string effectname = "123";

            TextBlock tb = new TextBlock
            {
                Text                = effectname,
                FontSize            = 22,
                HorizontalAlignment = HorizontalAlignment.Center
            };

            EffectLine el = new EffectLine();

            el.Width  = 500;
            el.Height = 50;

            return(el);
        }