public ItemTool(int id, float time, EnumToolType toolType, EnumBlockType effectiveOn) : base(id) { this.time = time; this.toolType = toolType; this.effectiveOn = effectiveOn; this.setMaxStackSize(1); }
private void SpawnNewBlock() { _blockType = _nextBlockType; _nextBlockType = GetRandomBlockType(); SetBlockType(); SetGameSpeed(); _playerBlock.Reset(); CheckGameOver(); }
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(); } }
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)); }
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; }
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); }
public void SetPreview(EnumBlockType enumBlockType) { _enumBlockType = enumBlockType; }
public Block(EnumBlockType type, int x, int y) { Type = type; X = x; Y = y; }
public Block setType(EnumBlockType blockType) { this.blockType = blockType; return(this); }
public Block(int x, int y, EnumBlockType type) { X = x; Y = y; Type = type; }
public Block(EnumBlockType type) { Type = type; }
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); }
/// /// <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))); }
// --------------------------------------------------------------------- // 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); }