Пример #1
0
    public void Update()
    {
        if (turrentTrans == null)
        {
            return;
        }

        if (Input.GetMouseButtonDown(0))
        {
            //alternate turrent state.
            string _currentType = turrentMovieClip.currentLocalFrameName();
            if (_currentType == "type1")
            {
                turrentMovieClip.gotoAndPlay("type2");
            }
            else if (_currentType == "type2")
            {
                turrentMovieClip.gotoAndPlay("type1");
            }
        }

        if (targetStateChangeInterval < 5)
        {
            targetStateChangeInterval++;
            return;
        }
        else
        {
            targetStateChangeInterval = 0;
        }

        if (isHit)
        {
            isHit = false;
            if (target.currentFrame < target.mcTimeLineInfo.totalFrames)
            {
                target.gotoAndStop(target.currentFrame + 1);
            }
            else
            {
                target.gotoAndStop(1);
            }
        }
    }