Exemplo n.º 1
0
        public ItemTool(int id, float time, EnumToolType toolType, EnumBlockType effectiveOn) : base(id)
        {
            this.time        = time;
            this.toolType    = toolType;
            this.effectiveOn = effectiveOn;

            this.setMaxStackSize(1);
        }
Exemplo n.º 2
0
 private void SpawnNewBlock()
 {
     _blockType     = _nextBlockType;
     _nextBlockType = GetRandomBlockType();
     SetBlockType();
     SetGameSpeed();
     _playerBlock.Reset();
     CheckGameOver();
 }
Exemplo n.º 3
0
        private void CheckGameRules(Player currentPlayer)
        {
            if (currentPlayer.Won)
            {
                EndGame(currentPlayer);
                return;
            }

            Block ruleBlock = _board.GetCorrespondingRuleBlock(currentPlayer.CurrentBlock);

            if (ruleBlock != null)
            {
                EnumBlockType currentBlockType = ruleBlock.Type;
                switch (currentBlockType)
                {
                case EnumBlockType.Dice:
                    // Nada a fazer, jogue de novo!
                    break;

                case EnumBlockType.GreenSkull:
                    currentPlayer.Penalized = true;
                    SwitchPlayer();
                    break;

                case EnumBlockType.SpeedBoots:
                    currentPlayer.DoubleDice = true;
                    SwitchPlayer();
                    break;

                case EnumBlockType.Hole:
                    currentPlayer.NegativeDice = true;
                    SwitchPlayer();
                    break;

                case EnumBlockType.BadluckRedSpot:
                    currentPlayer.Position = new Vector2(_board.PlayerStartPos.X, _board.PlayerStartPos.Y);
                    SwitchPlayer();
                    break;

                case EnumBlockType.Dynamite:
                    currentPlayer.DoubleNegativeDice = true;
                    SwitchPlayer();
                    break;

                default:
                    break;
                }
            }
            else
            {
                SwitchPlayer();
            }
        }
Exemplo n.º 4
0
        public static GameFieldBlock CreateRandom(GameField field, EnumBlockDirection direction)
        {
            EnumBlockType type;

            if (UnityEngine.Random.Range(1, 101) <= NORMAL_BLOCK_CHANCE)
            {
                type = EnumBlockType.normal;
            }
            else
            {
                type = (EnumBlockType)UnityEngine.Random.Range((int)EnumBlockType.normal, Enum.GetNames(typeof(EnumBlockType)).Length);
            }
            return(Create(field, type, direction));
        }
Exemplo n.º 5
0
 private void Reset()
 {
     _level          = 0;
     Score           = 0;
     _lineCombo      = 0;
     _frameCounter   = 0;
     _paused         = false;
     _gameOver       = false;
     _totalLines     = 0;
     _tenLineCounter = 0;
     _blockType      = GetRandomBlockType();
     _nextBlockType  = GetRandomBlockType();
     SetGameSpeed();
     SetBlockType();
     _blockPreview.SetPreview(_nextBlockType);
     lblLevel.Text       = _level.ToString();
     lblScore.Text       = Score.ToString();
     lblPaused.Visible   = false;
     lblGameOver.Visible = false;
 }
Exemplo n.º 6
0
        public static GameFieldBlock Create(GameField field, EnumBlockType type, EnumBlockDirection direction)
        {
            var block = new GameFieldBlock();

            block.type      = type;
            block.direction = direction;

            var path = "field_items/blocks/";

            if (type == EnumBlockType.barrier)
            {
                path += string.Format("barrier_{0}", direction);
            }
            else
            {
                path += type;
            }

            block.obj = Assets.TryReuse(path, parent: field.transform);
            Error.Verify(block.obj != null);

            var            pos        = new Vector2();
            var            border     = direction == EnumBlockDirection.up ? field.upper_left_border : field.bottom_left_border;
            var            blocks     = direction == EnumBlockDirection.up ? field.blocks.GetUpperBlocks() : field.blocks.GetBottomBlocks();
            GameFieldBlock last_block = null;

            if (blocks != null && blocks.Count > 0)
            {
                last_block = blocks[blocks.Count - 1];
            }

            pos.x = last_block != null ? last_block.obj.transform.position.x + block.obj.transform.localScale.x : border.x;
            pos.y = border.y;

            block.obj.transform.position = pos;

            return(block);
        }
Exemplo n.º 7
0
 public void SetPreview(EnumBlockType enumBlockType)
 {
     _enumBlockType = enumBlockType;
 }
Exemplo n.º 8
0
 public Block(EnumBlockType type, int x, int y)
 {
     Type = type;
     X    = x;
     Y    = y;
 }
Exemplo n.º 9
0
 public Block setType(EnumBlockType blockType)
 {
     this.blockType = blockType;
     return(this);
 }
Exemplo n.º 10
0
 public Block(int x, int y, EnumBlockType type)
 {
     X = x;
     Y = y;
     Type = type;
 }
Exemplo n.º 11
0
 public Block(EnumBlockType type)
 {
     Type = type;
 }
Exemplo n.º 12
0
 static JDFAutoCutBlock()
 {
     atrInfoTable[0] = new AtrInfoTable(AttributeName.BLOCKSIZE, 0x22222222, AttributeInfo.EnumAttributeType.XYPair, null, null);
     atrInfoTable[1] = new AtrInfoTable(AttributeName.BLOCKSUBDIVISION, 0x33333333, AttributeInfo.EnumAttributeType.XYPair, null, "1 1");
     atrInfoTable[2] = new AtrInfoTable(AttributeName.BLOCKTRF, 0x33333333, AttributeInfo.EnumAttributeType.matrix, null, "1 0 0 1 0 0");
     atrInfoTable[3] = new AtrInfoTable(AttributeName.BLOCKTYPE, 0x22222222, AttributeInfo.EnumAttributeType.enumeration, EnumBlockType.getEnum(0), null);
     atrInfoTable[4] = new AtrInfoTable(AttributeName.ASSEMBLYIDS, 0x33333111, AttributeInfo.EnumAttributeType.NMTOKENS, null, null);
     atrInfoTable[5] = new AtrInfoTable(AttributeName.BLOCKELEMENTSIZE, 0x33333333, AttributeInfo.EnumAttributeType.XYPair, null, null);
     atrInfoTable[6] = new AtrInfoTable(AttributeName.BLOCKELEMENTTYPE, 0x33333333, AttributeInfo.EnumAttributeType.enumeration, EnumBlockElementType.getEnum(0), null);
 }
Exemplo n.º 13
0
 ///
 ///          <summary> * (9) get attribute BlockType </summary>
 ///          * <returns> the value of the attribute </returns>
 ///
 public virtual EnumBlockType getBlockType()
 {
     return(EnumBlockType.getEnum(getAttribute(AttributeName.BLOCKTYPE, null, null)));
 }
Exemplo n.º 14
0
 //         ---------------------------------------------------------------------
 //        Methods for Attribute BlockType
 //        ---------------------------------------------------------------------
 ///
 ///          <summary> * (5) set attribute BlockType </summary>
 ///          * <param name="enumVar">: the enumVar to set the attribute to </param>
 ///
 public virtual void setBlockType(EnumBlockType enumVar)
 {
     setAttribute(AttributeName.BLOCKTYPE, enumVar == null ? null : enumVar.getName(), null);
 }