コード例 #1
0
ファイル: Grid.cs プロジェクト: MaxKomisar/Zombie-Set
        public void LoadContent(ContentManager content, GameScreen _mainGame)
        {
            m_mainGame  = (MainGameScreen)_mainGame;
            m_content   = content;
            gameFont    = content.Load <SpriteFont>("Font/GameFont");
            m_gridState = Grid_State.Falling;
            Cell tempCell;

            for (int i = 0; i < COL; i++)
            {
                for (int j = 0; j < ROW; j++)
                {
                    if (m_board[i, j] == 1)
                    {
                        int randomNumber = 0;
                        if (Global.GAMEMODE == GameMode.EasyClassic)
                        {
                            randomNumber = random.Next(1, 5);
                        }
                        if (Global.GAMEMODE == GameMode.NormalClassic || Global.GAMEMODE == GameMode.Level)
                        {
                            randomNumber = random.Next(1, 6);
                        }
                        Cell_Type type = (Cell_Type)randomNumber;
                        tempCell = new Cell(this);
                        tempCell.LoadContent(content, i - COL, j, type);
                        m_listNewCell.Add(tempCell);
                    }
                }
            }
            Falling();
        }
コード例 #2
0
        public void SetTime(Cell_Type _cellType, int _countCell)
        {
            bonusTime = 0.0f;
            if (Global.GAMEMODE != GameMode.Level)
            {
                switch (_cellType)
                {
                case Cell_Type.Type06:
                    bonusTime   = 1.0f * _countCell;
                    isBonusTime = true;
                    CountTime   = BONUSTIME;
                    break;

                case Cell_Type.Type07:
                    bonusTime   = 2.0f * _countCell;
                    isBonusTime = true;
                    CountTime   = BONUSTIME;
                    break;

                case Cell_Type.Type08:
                    bonusTime   = 4.0f * _countCell;
                    isBonusTime = true;
                    CountTime   = BONUSTIME;
                    break;
                }
                m_gameTime += bonusTime;
            }
        }
コード例 #3
0
ファイル: Grid.cs プロジェクト: MaxKomisar/Zombie-Set
        public void DragCompleteHandle()
        {
            switch (m_listTouch.Count)
            {
            case 0:
                break;

            case 1:
                m_listTouch[0].setEndTouch(false);
                m_gridState       = Grid_State.Wait;
                m_currentCellType = Cell_Type.None;
                break;

            case 2:
                m_listTouch[0].setEndTouch(true);
                m_listTouch[0].m_direction = m_listTouch[1].m_position;
                m_listTouch[1].setEndTouch(true);
                m_listTouch[1].m_direction = m_listTouch[0].m_position;
                if (m_gridState == Grid_State.Touching)
                {
                    m_gridState = Grid_State.ToTwo;
                }
                m_countBeExplosion = m_listTouch.Count;
                m_mainGame.SetPoint(m_currentCellType, 2, m_lastCellPos);
                SoundManager.GetInstance().PlaySound(ESound.FailCell);

                break;

            default:
                for (int i = 0; i < m_listTouch.Count; i++)
                {
                    if (m_listTouch[i].m_indexI == m_lastIndexI && m_listTouch[i].m_indexJ == m_lastIndexJ)
                    {
                        m_listTouch[i].SetWaitAction();
                    }
                    else
                    {
                        m_listTouch[i].setEndTouch(true);
                        m_listTouch[i].m_direction = m_lastCellPos;
                    }
                }
                Global.isFly = true;
                SwitchTouchingTo();
                //CalculatorPoint();
                m_countBeExplosion = m_listTouch.Count;

                break;
            }
            if (m_listTouch.Count >= 1)
            {
                randomCell(m_listTouch.Count);
            }

            if (m_listTouch.Count > 0)
            {
                m_countCell = m_listTouch.Count;
            }
            m_listTouch.Clear();
        }
コード例 #4
0
        public void LoadContent(ContentManager content, int _indexI, int _indexJ, Cell_Type _type)
        {
            m_type   = _type;
            m_indexI = _indexI;
            m_indexJ = _indexJ;

            m_position = new Vector2(m_indexJ * TILE + EXTRAPOS.X, m_indexI * TILE + EXTRAPOS.Y);
            rect       = new Rectangle((int)m_position.X, (int)m_position.Y, TILE, TILE);
            InitSprite();
        }
コード例 #5
0
ファイル: Grid.cs プロジェクト: MaxKomisar/Zombie-Set
        public void Reset(ContentManager content)
        {
            m_listTouch.Clear();
            m_listCell.Clear();
            m_listNewCell.Clear();
            m_listRandomType.Clear();
            m_currentRandomType = 0;
            m_gridState         = Grid_State.Falling;
            m_lastCellPos       = Vector2.Zero;
            m_lastIndexI        = 0;
            m_lastIndexJ        = 0;
            m_currentCellType   = Cell_Type.None;
            m_countCell         = 0;
            m_countBeExplosion  = 0;
            m_countFalling      = 0;

            Cell tempCell;

            for (int i = 0; i < COL; i++)
            {
                for (int j = 0; j < ROW; j++)
                {
                    if (m_board[i, j] == 1)
                    {
                        int randomNumber = 0;
                        if (Global.GAMEMODE == GameMode.EasyClassic)
                        {
                            randomNumber = random.Next(1, 5);
                        }
                        if (Global.GAMEMODE == GameMode.NormalClassic || Global.GAMEMODE == GameMode.Level)
                        {
                            randomNumber = random.Next(1, 6);
                        }
                        Cell_Type type = (Cell_Type)randomNumber;
                        tempCell = new Cell(this);
                        tempCell.LoadContent(content, i - COL, j, type);
                        m_listNewCell.Add(tempCell);
                    }
                }
            }
            Falling();
        }
コード例 #6
0
        public void SetGoal(Cell_Type _type, int _countCell)
        {
            switch (_type)
            {
            case Cell_Type.Type01:
                Goal_Type1 -= _countCell;
                break;

            case Cell_Type.Type02:
                Goal_Type2 -= _countCell;
                break;

            case Cell_Type.Type03:
                Goal_Type3 -= _countCell;
                break;

            case Cell_Type.Type04:
                Goal_Type4 -= _countCell;
                break;

            case Cell_Type.Type05:
                Goal_Type5 -= _countCell;
                break;

            case Cell_Type.Type06:
                Goal_Type6 -= _countCell;
                break;

            case Cell_Type.Type07:
                Goal_Type7 -= _countCell;
                break;

            case Cell_Type.Type08:
                Goal_Type8 -= _countCell;
                break;
            }
        }
コード例 #7
0
 public void SetGoal(Cell_Type _type, int _countCell)
 {
     m_levelManager.SetGoal(_type, _countCell);
 }
コード例 #8
0
 public void SetTime(Cell_Type _cellType, int _countCell)
 {
     m_gameTimeManager.SetTime(_cellType, _countCell);
 }
コード例 #9
0
 public void SetPoint(Cell_Type _cellType, int _countCell, Vector2 _posPoint)
 {
     m_pointManager.SetPoint(_cellType, _countCell, _posPoint);
 }
コード例 #10
0
ファイル: Grid.cs プロジェクト: MaxKomisar/Zombie-Set
        void InputHandle(GameTime gameTime)
        {
            if ((GesturesInput.GetInstance().GetGestureType() == GestureType.FreeDrag ||
                 GesturesInput.GetInstance().GetGestureType() == GestureType.HorizontalDrag ||
                 GesturesInput.GetInstance().GetGestureType() == GestureType.Hold ||
                 GesturesInput.GetInstance().GetGestureType() == GestureType.VerticalDrag) && (m_gridState == Grid_State.Wait || m_gridState == Grid_State.Touching))
            {
                Vector2 posTap = GesturesInput.GetInstance().GetGesturePosition();
                int     tempI  = (int)(posTap.Y - EXTRAPOS.Y) / TILE;
                int     tempJ  = (int)(posTap.X - EXTRAPOS.X) / TILE;

                for (int i = 0; i < m_listCell.Count; i++)
                {
                    if (m_listCell[i].IsContain(posTap))
                    {
                        if (isAvailable(tempI, tempJ) && (m_currentCellType == m_listCell[i].m_type || m_currentCellType == Cell_Type.None))
                        {
                            m_lastCellPos = m_listCell[i].m_position;
                            m_lastIndexI  = m_listCell[i].m_indexI;
                            m_lastIndexJ  = m_listCell[i].m_indexJ;
                            if (m_listCell[i].m_state == Cell_State.NoTouch)
                            {
                                switch (m_listCell[i].m_type)
                                {
                                case Cell_Type.Type01:
                                    SoundManager.GetInstance().PlaySound(ESound.TouchType1);
                                    break;

                                case Cell_Type.Type02:
                                    SoundManager.GetInstance().PlaySound(ESound.TouchType2);
                                    break;

                                case Cell_Type.Type03:
                                    SoundManager.GetInstance().PlaySound(ESound.TouchType3);
                                    break;

                                case Cell_Type.Type04:
                                    SoundManager.GetInstance().PlaySound(ESound.TouchType4);
                                    break;

                                case Cell_Type.Type05:
                                    SoundManager.GetInstance().PlaySound(ESound.TouchType5);
                                    break;

                                case Cell_Type.Type06:
                                    SoundManager.GetInstance().PlaySound(ESound.TouchType6);
                                    break;

                                case Cell_Type.Type07:
                                    SoundManager.GetInstance().PlaySound(ESound.TouchType7);
                                    break;

                                case Cell_Type.Type08:
                                    SoundManager.GetInstance().PlaySound(ESound.TouchType8);
                                    break;
                                }
                                m_listCell[i].setBeginTouch();
                                m_listTouch.Add(m_listCell[i]);
                                if (m_currentCellType == Cell_Type.None)
                                {
                                    m_currentCellType = m_listCell[i].m_type;
                                    m_gridState       = Grid_State.Touching;
                                }
                            }
                        }
                    }
                }
            }

            if (GesturesInput.GetInstance().GetGestureType() == GestureType.DragComplete)
            {
                DragCompleteHandle();
            }
            if (m_countFalling == 0 && m_gridState == Grid_State.Falling)
            {
                m_gridState = Grid_State.Wait;
            }
        }
コード例 #11
0
ファイル: Grid.cs プロジェクト: MaxKomisar/Zombie-Set
        public void removeCell(Cell _cell, bool isLast)
        {
            if (!isLast)
            {
                if (m_countCell >= 3)
                {
                    SoundManager.GetInstance().PlaySound(ESound.Fly);
                }
            }
            else
            {
                SoundManager.GetInstance().PlaySound(ESound.CompleteCell);
            }

            m_countBeExplosion--;

            if (!isLast)
            {
                CreateNew(_cell);
            }
            m_listCell.Remove(_cell);
            if (isLast)
            {
                m_mainGame.SetGoal(m_currentCellType, m_countCell);
                if (m_countCell >= 3)
                {
                    m_mainGame.SetPoint(m_currentCellType, m_countCell, m_lastCellPos);
                    m_mainGame.SetTime(m_currentCellType, m_countCell);
                }
            }

            if (m_gridState == Grid_State.ToTwo)
            {
                //m_mainGame.SetPoint(m_currentCellType, m_countCell, m_lastCellPos);
            }

            if (m_gridState == Grid_State.ToThree)
            {
                if (isLast)
                {
                    CreateNew(_cell);
                }
            }
            if (m_gridState == Grid_State.ToFour)
            {
                if (isLast)
                {
                    Create();
                }
            }
            if (m_gridState == Grid_State.ToFive)
            {
                if (isLast)
                {
                    Create();
                }
            }
            if (m_gridState == Grid_State.ToGold)
            {
                if (isLast)
                {
                    Create();
                }
            }
            if (m_gridState == Grid_State.ToFinal)
            {
                if (isLast)
                {
                    CreateNew(_cell);
                }
            }

            if (m_countBeExplosion == 0)
            {
                m_gridState = Grid_State.Falling;
                Falling();
                m_currentCellType = Cell_Type.None;
            }
        }
コード例 #12
0
ファイル: PointManager.cs プロジェクト: MaxKomisar/Zombie-Set
        public void SetPoint(Cell_Type _cellType, int _countCell, Vector2 _posPoint)
        {
            m_isDrawPoint = true;
            m_posPoint    = _posPoint + new Vector2(5, 10);
            m_timeFly     = 0;
            if (_countCell == 2)
            {
                m_currentPoint = -100;
                m_totalPoint  += m_currentPoint;
                return;
            }

            int _iPoint         = 0;
            int _typeBonusPoint = 0;
            int _startPoint     = 0;
            int _numBonusCell   = _countCell - 3;

            switch (_cellType)
            {
            case Cell_Type.Type01:
                _typeBonusPoint = TYPE1_BONUSPOINT;
                _startPoint     = TYPE1_STARTPOINT;
                break;

            case Cell_Type.Type02:
                _typeBonusPoint = TYPE2_BONUSPOINT;
                _startPoint     = TYPE2_STARTPOINT;
                break;

            case Cell_Type.Type03:
                _typeBonusPoint = TYPE3_BONUSPOINT;
                _startPoint     = TYPE3_STARTPOINT;
                break;

            case Cell_Type.Type04:
                _typeBonusPoint = TYPE4_BONUSPOINT;
                _startPoint     = TYPE4_STARTPOINT;
                break;

            case Cell_Type.Type05:
                _typeBonusPoint = TYPE5_BONUSPOINT;
                _startPoint     = TYPE5_STARTPOINT;
                break;

            case Cell_Type.Type06:
                _typeBonusPoint = TYPE6_BONUSPOINT;
                _startPoint     = TYPE6_STARTPOINT;
                break;

            case Cell_Type.Type07:
                _typeBonusPoint = TYPE7_BONUSPOINT;
                _startPoint     = TYPE7_STARTPOINT;
                break;

            case Cell_Type.Type08:
                _typeBonusPoint = TYPE8_BONUSPOINT;
                _startPoint     = TYPE8_STARTPOINT;
                break;
            }
            _iPoint        = _startPoint + _typeBonusPoint * _numBonusCell;
            m_currentPoint = _iPoint;
            m_totalPoint  += m_currentPoint;
            return;
        }