Esempio n. 1
0
        void SpawnIce(ref Vector3 mp)
        {
            Bullet     ice     = BoardManager.instance.bulletPool.DequeueObjectPool().GetComponent <Bullet>();
            BulletData iceData = (BulletData)(GameDatabase.instance.bullets[data.bulletIds[0]].Clone());

            iceData.limitTime = Mathf.Min(iceData.limitTime + GetValue(Value.Time).value, 4);
            iceData.GetEffect(EFFECT.Ice).value += GetEffect(EFFECT.Ice).value;
            iceData.disapearStartTime            = iceData.limitTime * 0.5f;
            iceData.disapearDuration             = iceData.disapearStartTime;

            ice.Init(BoardManager.instance.player, iceData);
            ice.Spawn(mp);
            //ice.Spawn(BoardManager.instance.player, iceData, mp);
        }
Esempio n. 2
0
        IEnumerator CheckEnd(Vector2 mp)
        {
            WaitForFixedUpdate wait = new WaitForFixedUpdate();
            Unit player             = BoardManager.instance.player;

            yield return(wait);

            float remain = player.rigid.velocity.sqrMagnitude;
            float before;
            float after = remain;

            float flameDelay = GetValue(Value.Delay).value;
            float flameTime  = flameDelay;
            int   amount     = (int)GetValue(Value.Amount).value;

            BulletData flameData = (BulletData)GameDatabase.instance.bullets[data.bulletIds[0]].Clone();

            flameData.GetEffect(EFFECT.Fire).value = GetValue(Value.Fire).value *player.stat.GetCurrent(STAT.TEC);

            do
            {
                before = after;
                yield return(wait);

                after = player.rigid.velocity.sqrMagnitude;
                float reduce = before - after;
                if (reduce > 0)
                {
                    remain -= reduce;
                }

                flameTime -= TimeManager.Instance.FixedDeltaTime;

                if (flameTime <= 0)
                {
                    for (int i = 0; i < amount; i++)
                    {
                        Bullet flame = BoardManager.instance.bulletPool.DequeueObjectPool().GetComponent <Bullet>();

                        flame.Init(player, flameData);
                        flame.Spawn((Vector2)player.transform.position + new Vector2(Random.Range(-0.2f, 0.2f), Random.Range(-0.2f, 0.2f)));
                        //Vector2 vec = (Vector2)player.transform.position + new Vector2(Random.Range(-0.2f, 0.2f), Random.Range(-0.2f, 0.2f));
                        //flame.Spawn(player, flameData, vec);
                    }
                    flameTime = flameDelay;
                }
            } while (remain > 3);
            OnRunEnd();
        }