Пример #1
0
    public Tetronimo(GameInstance gameInstance, TetronimoType type, int colorIdx)
    {
        this.gameInstance = gameInstance;
        this.type         = type;
        this.colorIdx     = colorIdx;

        UpdateGrid();
    }
Пример #2
0
        private void CreateZ()
        {
            var index = 0;

            this.m_TetronimoType = TetrisCSharp.TetronimoType.Z;
            for (int i = 16; i < 37; i = i + 20)
            {
                m_Form[index]     = new Point(i, 36);
                m_Form[index + 2] = new Point(i + 20, 56);
                index++;
            }
            m_Color = GameTileColors.Rot;
        }
Пример #3
0
        private void CreateT()
        {
            var index = 0;

            this.m_TetronimoType = TetrisCSharp.TetronimoType.T;
            m_Form[3]            = new Point(36, 56);
            for (int i = 16; i < 57; i = i + 20)
            {
                m_Form[index] = new Point(i, 36);
                index++;
            }
            m_Color = GameTileColors.Lila;
        }
Пример #4
0
        private void CreateS()
        {
            var index = 0;

            this.m_TetronimoType = TetrisCSharp.TetronimoType.S;
            for (int i = 36; i < 57; i = i + 20)
            {
                m_Form[index]     = new Point(i, 36);
                m_Form[index + 2] = new Point(i - 20, 56);
                index++;
            }
            m_Color = GameTileColors.Gruen;
        }
Пример #5
0
        private void CreateO()
        {
            var index = 0;

            this.m_TetronimoType = TetrisCSharp.TetronimoType.O;
            for (int i = 36; i < 57; i = i + 20)
            {
                m_Form[index]     = new Point(20, i);
                m_Form[index + 2] = new Point(40, i);
                index++;
            }
            m_Color = GameTileColors.Gelb;
        }
Пример #6
0
        private void CreateL()
        {
            var index = 0;

            this.m_TetronimoType = TetrisCSharp.TetronimoType.L;
            m_Form[3]            = new Point(56, 76);
            for (int i = 36; i < 77; i = i + 20)
            {
                m_Form[index] = new Point(36, i);
                index++;
            }
            m_Color = GameTileColors.Orange;
        }
Пример #7
0
        public void DisplayNewTetronimo(Tetronimo newBlock)
        {
            m_IsTetronimoGrounded = false;
            m_TetronimoType       = newBlock.TetronimoType;
            m_RotationState       = TetronimoRotationState.Eins;
            m_Tetronimo           = new List <GameTile>(4);
            var idList = m_TConverter.ConvertToGameGrid(newBlock);

            foreach (var item in idList)
            {
                var gameTile = FindGameTileByID(item);
                gameTile.Color       = newBlock.Color;
                gameTile.IsTetronimo = true;
                m_Tetronimo.Add(gameTile);
            }
        }
Пример #8
0
        private void CreateTetronimo(TetronimoType type)
        {
            switch (type)
            {
            case TetronimoType.I:
                CreateI();
                break;

            case TetronimoType.J:
                CreateJ();
                break;

            case TetronimoType.L:
                CreateL();
                break;

            case TetronimoType.O:
                CreateO();
                break;

            case TetronimoType.S:
                CreateS();
                break;

            case TetronimoType.T:
                CreateT();
                break;

            case TetronimoType.Z:
                CreateZ();
                break;

            case TetronimoType.Unknown:
                throw new TypeInitializationException("Tetronimo", null);

            default:
                throw new TypeInitializationException("Tetronimo", null);
            }
        }
Пример #9
0
 public void Mark(int x, int y, TetronimoType t)
 {
     GridSpaces[x, y] = t.ToString()[0];
 }
Пример #10
0
 public Tetronimo(TetronimoType type)
 {
     m_Form = new Point[4];
     CreateTetronimo(type);
 }