Example #1
0
    void AttackLeft()
    {
        //    second  -> size
        //min 0s      -> 0
        //    1s      -> 1.5
        //max 2s      -> 3
        //
        //2s : 3 = deltaTime(accumulate) : deltaSize
        //3 * deltaTime = 2s * deltaSize
        //3 * deltaTime / 2s = deltaSize
        //!!! _leftAnchor.ScaleZ( maxSize * accumulate / maxSecond);

        accumulate += Time.deltaTime;
        float scaleDelta = 1 + Mathf.Abs(Interpolation.punch(maxSize, accumulate / maxSecond));

        //float scaleDelta = Interpolation.easeOutBounce(1,maxSize,accumulate/maxSecond);
        //Debug.Log (accumulate + "   " + scaleDelta); //chamto test
        //_leftAnchor.ScaleZ (scaleDelta);
        _leftAnchor.ScaleZ(maxSize);

        if (maxSecond <= accumulate)
        {
            accumulate = 0;                                     //a. repeat
            //accumulate = maxSecond;	//b. one time
        }

        _leftAnchor.RotateX(directAngle);


        if (5f < angleSum || angleSum < -20f)
        {
            directAngle *= -1;
        }
        angleSum += directAngle;
    }