Ejemplo n.º 1
0
        IEnumerator HakoDeleteStream(Vector3 _pos, HakoType _type)
        {
            Combo  = Mathf.Abs(Combo) + 1;
            Score += Combo;
            SurvivalUI.Instance.ScoreDisplay.Value = Score;
            SwipeMessage.Play("+" + Combo.ToString(), _pos, 28 + Mathf.Min(Combo * 7 / 2, 42));
            yield return(null);

            if (Score >= Data.LevelUpScore[Level])
            {
                Level++;
                SurvivalUI.Instance.LevelDisplay.Value = Level;
                SurvivalUI.Instance.Meter.MaxHakos(Data.LevelUpScore[Level] - Data.LevelUpScore[Level - 1]);
                SwipeMessage.Play("LevelUp!", new Vector3(), 42, 0.5f);
                SoundManager.SEPlay("levelup");
                for (int x = 0; x < Data.Size.x; x++)
                {
                    for (int y = 0; y < Data.Size.y; y++)
                    {
                        int _tar = HakoManaer.Instance.Map[x, y];
                        if (_tar > 0 && !HakoManaer.Instance.Hakos[_tar].IsGhost)
                        {
                            HakoManaer.Instance.DeleteHako(_tar);
                        }
                    }
                }
            }
            else
            {
                SoundManager.SEPlay("add", 1.0f + (Combo - 1) * 0.06f);
            }
            SurvivalUI.Instance.Meter.AddHako(_type, Score - Data.LevelUpScore[Level - 1]);
            HakoUpdate();
        }
Ejemplo n.º 2
0
 public int GetUnuseHako(HakoType _type)
 {
     for (int i = 0; i < Hakos.Length; i++)
     {
         if (!Hakos[i].Active && Hakos[i].Type == _type)
         {
             return(i);
         }
     }
     return(-1);
 }
Ejemplo n.º 3
0
        public HakoAnimation GetHakoPrefab(HakoType _type)
        {
            switch ((int)_type)
            {
            case 0: return(X_Prefab);

            case 1: return(A_Prefab);

            case 2: return(B_Prefab);

            case 3: return(C_Prefab);

            case 4: return(D_Prefab);
            }
            return(E_Prefab);
        }
Ejemplo n.º 4
0
        public int AddHako(HakoType _type, Vector2Int _pos, float _time = -1)
        {
            if (GetMapNumber(_pos) >= 0)
            {
                return(-1);
            }
            int _num = GetUnuseHako(_type);

            if (_num < 0)
            {
                Debug.Log("はこがたりない?"); return(-1);
            }
            Map[_pos.x, _pos.y] = _num;
            Hakos[_num].Appear(_time, true);
            Hakos[_num].Move(_pos, -1);
            return(_num);
        }
Ejemplo n.º 5
0
 IEnumerator AddHakoStream(HakoType _type, int _count = 1)
 {
     while(bisy){yield return null;}
     _count -= HakoValue;
     if(_count <= 0){yield break;}
     bisy = true;
     int[] _nums = new int[_count];
     for(int i = 0; i < _nums.Length; i++)
     {
         _nums[i] = -1;
     }
     int _cur = 0;
     for(int i = 0; i < fronts.Length; i++)
     {
         if(!fronts[i].Active && fronts[i].Type == _type)
         {
             _nums[_cur] = i;
             _cur++;
             if(_cur>=_nums.Length - 1){break;}
         }
     }
     for(int i = _cur; i < _nums.Length; i++)
     {
         yield return null;
         Array.Resize(ref fronts, fronts.Length + 1);
         fronts[fronts.Length - 1] = Instantiate(dressupData.GetHakoPrefab(_type), transform);
         _nums[i] = fronts.Length - 1;
     }
     yield return null;
     for(int i = 0; i < _nums.Length; i++)
     {
         fronts[_nums[i]].Move(GetPosition(0), -1);
         yield return new WaitForSeconds(0.1f);
         fronts[_nums[i]].Appear(10.0f);
         fronts[_nums[i]].Move(GetPosition(1, HakoValue));
         HakoValue++;
     }
     bisy = false;
 }
Ejemplo n.º 6
0
 public void AddHako(HakoType _type, int _count = 1)
 {
     StartCoroutine(AddHakoStream(_type,  _count));
 }
Ejemplo n.º 7
0
        void AddHakoRandom()
        {
            Vector2Int[] _candi    = new Vector2Int[Data.Size.x * Data.Size.y];
            int          _maxCount = 0;

            int[] _typeCount = new int[] { 0, 0, 0, 0, 0, 0 };
            // 出現位置は:まず、外周以外にランダム。
            for (int x = 1; x < Data.Size.x - 1; x++)
            {
                for (int y = 1; y < Data.Size.y - 1; y++)
                {
                    if (HakoManaer.Instance.Map[x, y] < 0)
                    {
                        _candi[_maxCount] = new Vector2Int(x, y);
                        _maxCount++;
                    }
                    else
                    {
                        _typeCount[(int)HakoManaer.Instance.Hakos[HakoManaer.Instance.Map[x, y]].Type]++;
                    }
                }
            }
            // 出現位置は:つぎに、外周にランダム。
            if (_maxCount <= 0)
            {
                Vector2Int _start = Vector2Int.zero;
                for (int i = 0; i < 4; i++)
                {
                    Vector2Int _dir = HakoManaer.Instance.DirVector(InputManager.GetIntToDir(i));
                    int        _max = i % 2 == 0?Data.Size.y - 1:Data.Size.x - 1;
                    for (int j = 0; j < _max; j++)
                    {
                        Vector2Int _target = _start + _dir * j;
                        if (HakoManaer.Instance.Map[_target.x, _target.y] < 0)
                        {
                            _candi[_maxCount] = _target;
                            _maxCount++;
                        }
                        else
                        {
                            _typeCount[(int)HakoManaer.Instance.Hakos[HakoManaer.Instance.Map[_target.x, _target.y]].Type]++;
                        }
                    }
                    _start += _dir * _max;
                }
            }
            if (_maxCount > 0)
            {
                HakoType _type       = 0;
                int      _typeRandom = 0;
                for (int i = 1; i < 5; i++)
                {
                    _typeRandom += (Data.MaxHakos - _typeCount[i]);
                }
                _typeRandom = Random.Range(0, _typeRandom - 1);
                for (int i = 1; i < 5; i++)
                {
                    _typeRandom -= (Data.MaxHakos - _typeCount[i]);
                    if (_typeRandom < 0)
                    {
                        _type = HakoManaer.Instance.GetIntToType(i);
                        break;
                    }
                }
                Vector2Int _pos = _candi[Random.Range(0, _maxCount)];
                HakoManaer.Instance.AddHako(_type, _pos, 1.0f / Data.AppearTimes[Level]);
            }
        }
Ejemplo n.º 8
0
 public override void HakoDelete(Vector3 _pos, HakoType _type)
 {
     StartCoroutine(HakoDeleteStream(_pos, _type));
 }
Ejemplo n.º 9
0
 virtual public void HakoDelete(Vector3 _pos, HakoType _type)
 {
 }