Exemplo n.º 1
0
    void Update()
    {
        if (_bStart)
        {
            Vector3 curPoint = Vector3.zero;
            //path_bezier.GetPointAtTime((float)_nCount / (float)70, out curPoint);
            //transform.localPosition = curPoint;
            //_nCount++;
            //if(curPoint == path_bezier.p3)
            //{
            //    transform.localPosition = new Vector3(1000, 1000, transform.localPosition.z);
            //    clearData();
            //    GoldBehavior.getInstance().setCoinInList(gameObject, false);
            //}


            //float timeX = Mathf.Abs(path_bezier.p0.x - path_bezier.p3.x) / 0.01f;
            //float timeY = Mathf.Abs(path_bezier.p0.y - path_bezier.p3.y) / 0.01f;

            _nTime += Time.deltaTime;
            Vector3 pos = Vector3.Lerp(_startpos, _endpos, _nTime / _nTotalTime);
//             float curPointX = 0.0f;
//             float curPointY = 0.0f;
//             if (path_bezier.p0.x > path_bezier.p3.x)
//                 curPointX = path_bezier.p0.x - (vX * _nTime);
//             else
//                 curPointX = path_bezier.p0.x + (vX * _nTime);
//
//             if (path_bezier.p0.y > path_bezier.p3.y)
//                 curPointY = path_bezier.p0.y - (vY * _nTime);
//             else
//                 curPointY = path_bezier.p0.y + (vY * _nTime);

            //curPoint = new Vector3(curPointX, curPointY, path_bezier.p0.z);
            transform.position = pos;
            if (Mathf.Abs(pos.x - _endpos.x) <= 0.01 && Mathf.Abs(pos.y - _endpos.y) <= 0.01)
            {
                clearCoinBezierData();
                transform.position = new Vector3(1000, 1000, transform.position.z);

                PListMono plistMono = transform.Find("Icon").GetComponent <PListMono>();
                plistMono.enabled = false;
                Animator animator = transform.Find("Icon").GetComponent <Animator>();
                animator.enabled = false;

                GoldBehavior.getInstance().setCoinInList(gameObject, false);
            }
        }
    }
Exemplo n.º 2
0
    public void insertGameObj(GameObject coinObj, bool bGold, bool bActive, int nIndex = 9999999)
    {
        CoinObjInfo coin = new CoinObjInfo();

        coin.CoinObj = coinObj;
        coin.Active  = bActive;

        Animator animator = coinObj.transform.Find("Icon").GetComponent <Animator>();

        animator.enabled = false;

        PListMono plistMono = coinObj.transform.Find("Icon").GetComponent <PListMono>();

        plistMono.enabled = false;

        coin.CoinObj.transform.position = new Vector3(1000, 1000, coin.CoinObj.transform.position.z);

        if (bGold)
        {
            if (nIndex == 9999999)
            {
                _goldList.Add(coin);
            }
            else
            {
                _goldList.Insert(nIndex, coin);
            }
        }
        else
        {
            if (nIndex == 9999999)
            {
                _silverList.Add(coin);
            }
            else
            {
                _silverList.Insert(nIndex, coin);
            }
        }
    }
Exemplo n.º 3
0
    void StartPlayAnimation()
    {
        transform.Find("Icon").localPosition = new Vector3(Vector3.zero.x, Vector3.zero.y + 30, Vector3.zero.z);
        transform.position = _startpos;

        PListMono plistMono = transform.Find("Icon").GetComponent <PListMono>();
        int       nFrame    = Random.Range(0, plistMono.frameCount - 1);

        plistMono.nCurFrame  = nFrame;
        plistMono.enabled    = true;
        plistMono.frameSpeed = 0.04f;
        Animator animator = transform.Find("Icon").GetComponent <Animator>();

        animator.enabled = true;
        animator.Rebind();
        animator.Play("jinbidiaoluoAnimation");

        Invoke("changeFreameSpeed", 0.4f);
        Invoke("StartBezier", _nStayTime);

        //StartBezier();
    }
Exemplo n.º 4
0
    void changeFreameSpeed()
    {
        PListMono plistMono = transform.Find("Icon").GetComponent <PListMono>();

        plistMono.frameSpeed = 0.055f;
    }