예제 #1
0
        // 创建一个金币柱.
        void CreateCylinder(CylinderParam _cp)
        {
            Transform _cylinder = Factory.Create(cylinderPrefab, Vector3.zero, Quaternion.identity);

            _cylinder.parent     = transform;
            _cylinder.localScale = Vector3.one;
            cylinderNumInScene++;

            if (cylinderHaveCreatedList.Count > 0)
            {
                _cylinder.localPosition = new Vector3(cylinderHaveCreatedList[cylinderHaveCreatedList.Count - 1].localPosition.x, 0f, 0f)
                                          - new Vector3(cylinderDistance, 0f, 0f);
            }
            else
            {
                _cylinder.position = _cp.showupPos;
            }

            // _cylinder.rotation = _cp.showupRot;
            _cylinder.localEulerAngles = Vector3.zero;

            _cylinder.GetComponent <SingleCylinder>().Init(_cp.multi, _cp.value, dir);
            cylinderHaveCreatedList.Add(_cylinder);

            if (curCylinderState == CylinderState.finish)
            {
                lerpPercent = 0f;
                curStepPos  = curTrans.localPosition;
                switch (dir)
                {
                case 0:
                    nextStepPos = curTrans.localPosition + new Vector3(cylinderDistance, 0f, 0f);
                    break;

                case 1:
                    nextStepPos = curTrans.localPosition + new Vector3(0f, cylinderDistance, 0f);
                    break;

                case 2:
                    nextStepPos = curTrans.localPosition - new Vector3(cylinderDistance, 0f, 0f);
                    break;

                case 3:
                    nextStepPos = curTrans.localPosition - new Vector3(0f, cylinderDistance, 0f);
                    break;
                }
                curCylinderState = CylinderState.jump;
            }
        }
예제 #2
0
        // 添加一个要创建的金币柱.
        public void Add2Need2CreateList(int _multi, int _value, Vector3 _showupPos)
        {
            if (Time.time > targetTime)
            {
                targetTime = Time.time;
            }

            CylinderParam _b = new CylinderParam();

            _b.multi     = _multi;
            _b.value     = _value;
            _b.showupPos = _showupPos;
            _b.showupRot = Quaternion.Euler(new Vector3(0f, 0f, dir * 90f));

            cylinder2CreateList.Add(_b);
        }