Пример #1
0
        public void AddBall(MiroV1RingBallBase ball)
        {
            ball.transform.SetParent(transform);

            MiroV1BlackDotMgr mgr = GetComponentInParent <MiroV1BlackDotMgr> ();

            mgr.NewBlackDot(ball);

            _Balls.Add(ball);

            /*
             * int count = _Balls.Count;
             * if (count >= _RingBallAdded.Count)
             *      return;
             *
             *
             *
             *
             *
             * if (!_Balls.Contains (ball)) {
             *      EventWithGameObject evnt = _RingBallAdded [count];
             *      evnt.Invoke (ball.gameObject);
             *      _Balls.Add (ball);
             * }
             */
        }
Пример #2
0
        //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 ();
            }
        }
Пример #3
0
        public void Update()
        {
            if (_blackDot == null)
            {
                return;
            }

            /*
             * _blackDot._HPMax = _HPMax;
             * _blackDot._HP = _HP;
             */

            if (_GrowTrigger)
            {
                _blackDot.Grow();
                _GrowTrigger = false;
            }
            if (_ShrinkTrigger)
            {
                _blackDot.Shrink();
                _ShrinkTrigger = false;
            }
            if (_BreakTrigger)
            {
                _blackDot.Break();
                _BreakTrigger = false;
            }
            if (_RecoverTrigger)
            {
                if (_RecoverFull)
                {
                    _blackDot.RecoverMax();
                }
                else
                {
                    _blackDot.Recover();
                }
                _RecoverTrigger = false;
            }
            if (_ShrinkRingTrigger)
            {
                MiroV1RingBallBase rb = (MiroV1RingBallBase)_blackDot;
                if (rb != null)
                {
                    rb.ShringWholeRing();
                }
                _ShrinkRingTrigger = false;
            }
        }