Exemple #1
0
        static public int RemoveFullRows(RemoveCallBack remove, DropCallBack drop)
        {
            int dropRows = 0;

            for (int y = 0; y <= TopRow; y++)
            {
                bool full = true;
                for (int x = 0; x < Width; x++)
                {
                    if (Grid[LinearPosition(x, y)] == Entity.Null)
                    {
                        full = false;
                        break;
                    }
                }
                if (full)
                {
                    dropRows++;
                    for (int x = 0; x < Width; x++)
                    {
                        remove(Grid[LinearPosition(x, y)]);
                        Grid[LinearPosition(x, y)] = Entity.Null;
                    }
                }
                else if (dropRows > 0)
                {
                    for (int x = 0; x < Width; x++)
                    {
                        int lpos = LinearPosition(x, y);
                        if (Grid[lpos] != Entity.Null)
                        {
                            drop(Grid[lpos], dropRows);
                            Grid[LinearPosition(x, y - dropRows)] = Grid[lpos];
                            Grid[lpos] = Entity.Null;
                        }
                    }
                }
            }
            if (dropRows > 0)
            {
                TopRow             -= dropRows;
                CurrentScore       += dropRows;
                Instance.Score.text = CurrentScore.ToString();
            }
            return(dropRows);
        }
 /// <summary>
 /// 怪物掉落的控制
 /// </summary>
 public void MonsterDrop(DropCallBack dropCallBack)
 {
     /*
      * _dropCallBack = dropCallBack;
      * var position = MeController.Me.GoBase.transform.position;
      * var mapRange = AppMap.Instance.mapParser.CurrentMapRange;
      * position.y = Random.Range(mapRange.MinY, mapRange.MaxY);
      * position.z = position.y*5;
      * //SetHurtFlyState();
      * var argsHashtable = new Hashtable
      *          {
      *              {"time", 1f},
      *              {"position", position},
      *              {"oncomplete", "OnMoveEnd"}
      *          };
      *          iTween.MoveTo(MeController.Me.GoBase.transform.gameObject, argsHashtable);*/
     vp_Timer.In(0.2f, SetHurtFlyState);
     vp_Timer.In(0.5f, SetHurtDownState);
 }
 public void OnDrop(PointerEventData eventData)
 {
     DropCallBack.Invoke(eventData, GetInstanceID());
 }