コード例 #1
0
ファイル: MiroRing.cs プロジェクト: shacleff/LianQiClient
        void ShrinkEveryRingBall()
        {
            for (int i = _RingObjTfs.Count - 1; i >= 0; i--)
            {
                if (_RingObjTfs [i] == null)
                {
                    _RingObjTfs.RemoveAt(i);
                }
            }

            foreach (Transform tf in _RingObjTfs)
            {
                /*
                 * MiroModelV1 miro = tf.gameObject.GetComponent<MiroModelV1> ();
                 * miro.DestroyEveryRingBall ();
                 */

                RingBalls ringballs = tf.gameObject.GetComponentInChildren <RingBalls> ();
                ringballs.DestroyBalls();

                /*
                 * foreach (MiroV1RingBallBase ball in ringballs._Balls) {
                 *      Destroy (ball.gameObject);
                 *      print ("Destroy:" + ball.gameObject);
                 * }
                 * ringballs.ClearBalls ();
                 */
            }
        }
コード例 #2
0
ファイル: MiroRing.cs プロジェクト: shacleff/LianQiClient
        //public float BallStepMultiplier = 1.0f;
        void InitRingBallsForEachObj(int edgeObjCount, int objCount, float objStep)
        {
            for (int i = 0; i < objCount; i++)
            {
                GameObject MiroObj   = _RingObjTfs [i].gameObject;
                RingBalls  ringBalls = MiroObj.GetComponentInChildren <RingBalls> ();
                if (ringBalls == null)
                {
                    continue;
                }

                float      idCtr     = objStep * (float)i;
                int        ballCount = Mathf.Min(_MaxBallCount, objCount);
                float      ballStep  = objStep / (float)(ballCount + 1);
                int        ballIdMin = (int)(idCtr - ballStep * (float)ballCount / 2.0f);
                List <int> ObjHPs    = new List <int> ();
                for (int k = 0; k < ballCount; k++)
                {
                    ObjHPs.Add(0);
                }
                int hp = objCount;
                for (int p = 0; p < hp; p++)
                {
                    int idObj = (int)Mathf.Repeat(p, ObjHPs.Count);
                    ObjHPs [idObj]++;
                }
                for (int k = 0; k < ballCount; k++)
                {
                    float ballIdf = (float)ballIdMin + (float)k * ballStep;
                    int   id0     = Mathf.FloorToInt(ballIdf) + edgeObjCount;
                    int   id1     = Mathf.CeilToInt(ballIdf) + edgeObjCount;
                    id0 = (int)Mathf.Repeat(id0, edgeObjCount - 1);
                    id1 = (int)Mathf.Repeat(id1, edgeObjCount - 1);
                    if (id0 == id1)
                    {
                        id1++;
                    }
                    Transform  tf0         = _BCoordObjsGenerator._BCoords [id0].transform;
                    Transform  tf1         = _BCoordObjsGenerator._BCoords [id1].transform;
                    GameObject newRingBall = Instantiate(_RingBallPref) as GameObject;

                    InitRingBallPlacer(tf0, tf1, newRingBall);
                    MiroV1RingBallBase ringBall = newRingBall.GetComponent <MiroV1RingBallBase> ();
                    ringBall._HPMax = ObjHPs [k];
                    ringBall._HP    = ObjHPs [k];
                    ringBall.SetRing(this);
                    ringBalls.AddBall(ringBall);
                }



                //ringBalls.Grow ();
            }
        }