public Block(Game game, Model m, Vector3 loc) : base(game) { model = m; state = BlockState.PACKAGE; location = loc; }
public Block(Game game, Model m) : base(game) { model = m; state = BlockState.PACKAGE; location = new Vector3(0.0f, 0.0f, -50.0f); }
private float GetMass(BlockState blockState) { // TODO: These should be based on the block prototypes var mass = 0.0f; switch (blockState.blockType) { case BlockType.Square: mass = 20; break; case BlockType.Hexagon: mass = 60; break; case BlockType.Trapezoid: mass = 30; break; case BlockType.Rhombus: mass = 20; break; case BlockType.Triangle: mass = 10; break; case BlockType.ThinRhombus: mass = 10; break; case BlockType.Unknown: default: mass = 0; break; } return mass; }
// Use this for initialization void Start () { blockState = FindObjectOfType<BlockState>(); pauseScript = FindObjectOfType<Pause>(); anim = GetComponent<Animator>(); cam = FindObjectOfType<CameraShake>(); }
public static BlockState GetState(BlockState type, IBlockState state) { if (state is BlockBreakingState) { type = (BlockState)((int)type | (int)BlockState.Breaking); } return type; }
public Block(int x, int y, int value) { this.X = x; this.Y = y; this._state = BlockState.Value; this.Value = value; this.Guess = GuessState.None; this.RoundGuess = BlockState.Unknown; }
public void FinishSwapping(int swapX) { State = BlockState.Static; Direction = Swapper.SwapDirection.None; X = swapX; grid.AddBlock(X, Y, this, GridElement.ElementState.Block); }
public void FinishSliding(int slideX) { State = BlockState.Idle; Direction = Slider.SlideDirection.None; X = slideX; grid.AddBlock(X, Y, this, GridElement.ElementState.Block); }
public Block(int x, int y, BlockState state, bool userGuess = false) { this.X = x; this.Y = y; this._state = state; this.Value = 0; this.Guess = GuessState.None; this.RoundGuess = BlockState.Unknown; this.UserGuess = userGuess; }
/// <summary> /// Clears any (round) guess that have been made on the board since the last call to this method. /// </summary> private void clearAllRoundGuesses(BlockState targetState = BlockState.Flag | BlockState.Value) { for (int i = 0; i < roundGuesses.Count; i++) { if ((targetState & roundGuesses[i].RoundGuess) == roundGuesses[i].RoundGuess) { roundGuesses[i].SetRoundGuess(BlockState.Unknown, roundGuesses); roundGuesses.RemoveAt(i--); } } }
public Sprite GetSprite(BlockState state) { if (((int)state & 0xFF00) > 0) // Must be breaking { return new BrickBreaking(content); } switch (state) { case BlockState.Brick: return new Brick(content); case BlockState.Floor: return new Floor(content); case BlockState.Floor2: return new Floor2(content); case BlockState.Hidden: case BlockState.Death: return new Hidden(content); case BlockState.Pyramid: return new Pyramid(content); case BlockState.Pyramid2: return new Pyramid2(content); case BlockState.Question: return new Question(content); case BlockState.Used: return new Used(content); } //switch ((int)state & 0xFFFF) //{ // case 0x0401: // return new BrickBreaking(content); // case 0x0201: // return new BrickColliding(content); // case 0x0101: // return new Brick(content); // case 0x0008: // return new Floor(content); // case 0x0010: // return new Pyramid(content); // case 0x0202: // return new QuestionColliding(content); // case 0x0102: // return new QuestionNormal(content); // case 0x0204: // return new UsedColliding(content); // case 0x0104: // return new UsedNormal(content); // default: // return new Pyramid(content); // Because why not? //} return new Pyramid(content); }
public Block(Vector2 position, BlockState initialType, Megaman megaman, ContentManager content) { spriteFactory = new BlockSpriteFactory(content); stateMachine = new BlockStateMachine(this, megaman); currentState = stateMachine.GetState(BlockState.Normal); currentType = initialType; currentSprite = spriteFactory.GetSprite(BlockStateHelper.GetState(currentType, currentState)); currentSprite.Position = position; initialPosition = position; this.initialType = initialType; }
public BlockState CurState = BlockState.Normal; //当前状态 public void RefreshBlockSprite(int flag) { if (m_blockSprite == null) { return; } if ((flag & (int)GridFlag.Cage) > 0) { CurState = BlockState.Locked; } switch (special) { case TSpecialBlock.ESpecial_Normal: { m_blockSprite.spriteName = "Item" + (int)(color - TBlockColor.EColor_None); } break; case TSpecialBlock.ESpecial_NormalPlus5: { m_blockSprite.spriteName = "TimeAdded" + (int)(color - TBlockColor.EColor_None); } break; case TSpecialBlock.ESpecial_EatLineDir0: m_blockSprite.spriteName = "Line" + (int)(color - TBlockColor.EColor_None) + "_3"; break; case TSpecialBlock.ESpecial_EatLineDir1: m_blockSprite.spriteName = "Line" + (int)(color - TBlockColor.EColor_None) + "_1"; break; case TSpecialBlock.ESpecial_EatLineDir2: m_blockSprite.spriteName = "Line" + (int)(color - TBlockColor.EColor_None) + "_2"; break; case TSpecialBlock.ESpecial_Bomb: m_blockSprite.spriteName = "Bomb" + (int)(color - TBlockColor.EColor_None); break; case TSpecialBlock.ESpecial_Painter: { m_blockSprite.spriteName = "Painter" + (int)(color - TBlockColor.EColor_None); } break; case TSpecialBlock.ESpecial_EatAColor: m_blockSprite.spriteName = "Rainbow"; break; default: break; } if(m_addColorTranform != null) { m_addColorTranform.renderer.material.mainTexture = Resources.Load(m_blockSprite.spriteName, typeof(Texture)) as Texture; } }
public IBlockState GetState(BlockState state) { switch (state) { case BlockState.Breaking: return new BlockBreakingState(); case BlockState.Colliding: return new BlockCollidingState(block, megaman); case BlockState.Normal: default: return new BlockNormalState(block, megaman); } }
public void InitializeIdle(int x, int y, int type) { X = x; Y = y; Type = type; State = BlockState.Idle; // Initializing Grid here again. It looks like Start isn't getting called until the next frame grid = GameObject.Find("Grid").GetComponent<Grid>(); grid.AddBlock(x, y, this, GridElement.ElementState.Block); transform.position = new Vector3(X, Y, 0.0f); }
/// <summary> /// Highlights the text of the current block. /// </summary> /// <param name="formattedText">The text from the current block to highlight</param> /// <param name="lastBlockState"></param> /// <returns>The current block code</returns> public void Highlight(IFormattedTextBlock formattedText, BlockState lastBlockState) { Initialise(); bool inComment = lastBlockState == BlockState.InComment; string text = formattedText.Text; int offset = 0; string[] lines = text.Split('\n'); foreach (string line in lines) { inComment = FormatLine(formattedText, line, offset, inComment); offset += line.Length + 1; } formattedText.State = inComment ? BlockState.InComment : BlockState.Normal; }
// Untested public void InitializeAwakening(int x, int y, int flavor, float popDuration, float awakenDuration, ComboTabulator combo, int popColor) { X = x; Y = y; Flavor = flavor; State = BlockState.Awakening; AwakenDuration = awakenDuration; this.popDuration = popDuration; //popDirection = BlockManager.GeneratePopDirection(); //this.popColor = popColor; CurrentCombo = combo; CurrentCombo.IncrementInvolvement(); //Game.AwakeningCount++; grid.AddBlock(x, y, this, GridElement.ElementState.Immutable); }
// Use this for initialization void Start () { blockState = FindObjectOfType<BlockState>(); }
/// <summary> /// Initializes the block by setting its state to empty and unmatchable type /// </summary> void Awake() { State = BlockState.Empty; Type = -1; }
void SetStateToMatch() { mState = BlockState.Match; }
public void Set(int x, int y, int z, BlockState state) { Set(0, x, y, z, state); }
private bool HandleClick(Item slot, int hand, int inventorySlot, bool canModifyWorld = true, bool isLeftClick = false) { // Log.Info($"Clicky clicky click. Left click: {isLeftClick} Can modify world: {canModifyWorld} HasRaytrace: {HasRaytraceResult}"); SwingArm(true); //if (ItemFactory.ResolveItemName(slot.ItemID, out string itemName)) { var flooredAdj = Vector3.Floor(AdjacentRaytrace); var raytraceFloored = Vector3.Floor(Raytraced); var adj = flooredAdj - raytraceFloored; adj.Normalize(); var face = adj.GetBlockFace(); var remainder = new Vector3(AdjacentRaytrace.X - flooredAdj.X, AdjacentRaytrace.Y - flooredAdj.Y, AdjacentRaytrace.Z - flooredAdj.Z); var coordR = new BlockCoordinates(raytraceFloored); //IBlock block = null; if (/*!IsWorldImmutable &&*/ HasRaytraceResult) { var existingBlock = Level.GetBlock(coordR); bool isBlockItem = slot is ItemBlock; if (existingBlock.CanInteract && (!isBlockItem || IsSneaking)) { Network?.WorldInteraction(this, coordR, face, hand, inventorySlot, remainder); Log.Info($"World interaction."); return(true); } if (slot is ItemBlock ib && canModifyWorld) { // Log.Info($"Placing block."); BlockState blockState = ib.Block; if (blockState != null && !(blockState.Block is Air) && HasRaytraceResult) { if (existingBlock.IsReplacible || !existingBlock.Solid) { // Log.Info($"Placing block 1"); if (CanPlaceBlock(coordR, (Block)blockState.Block)) { Level.SetBlockState(coordR, blockState); Network?.BlockPlaced(coordR.BlockDown(), BlockFace.Up, hand, inventorySlot, remainder, this); return(true); } } else { // Log.Info($"Placing block 2"); var target = new BlockCoordinates(raytraceFloored + adj); if (CanPlaceBlock(target, (Block)blockState.Block)) { Level.SetBlockState(target, blockState); Network?.BlockPlaced(coordR, face, hand, inventorySlot, remainder, this); return(true); } } } } else if (!(slot is ItemBlock)) { // Log.Info($"Item is not a block, got type of: {slot.GetType()}"); } } if (!(slot is ItemAir) && slot.Id > 0 && slot.Count > 0) { ItemUseAction action; if (isLeftClick) { action = HasRaytraceResult ? ItemUseAction.ClickBlock : ItemUseAction.ClickAir; } else { action = HasRaytraceResult ? ItemUseAction.RightClickBlock : ItemUseAction.RightClickAir; } Network?.UseItem(slot, hand, action, coordR, face, remainder); return(true); } }
public uint IdForState(BlockState state) { return(stateToId[state]); }
public void Fall() { State = BlockState.Falling; FallTimeElapsed = TimeSpan.Zero; }
public static ItemStack GetItemStack(BlockState state) { return(GetItem(state.Block.UnlocalizedName) is ItemBlock ib ? new ItemStack(ib, 1, state.Block.GetMetaFromState(state)) : null); }
// Start sliding public void Slide() { State = BlockState.Sliding; SlideTimeElapsed = TimeSpan.Zero; }
public void WaitToFall() { State = BlockState.WaitingToFall; fallDelayTimeElapsed = TimeSpan.Zero; }
public void Reset() { _loopInstructions.Reset(); State = BlockState.New; }
public void Reset() => State = BlockState.New;
private bool HandleRightClick(Item slot, int hand) { //if (ItemFactory.ResolveItemName(slot.ItemID, out string itemName)) { var flooredAdj = Vector3.Floor(AdjacentRaytrace); var raytraceFloored = Vector3.Floor(Raytraced); var adj = flooredAdj - raytraceFloored; adj.Normalize(); var face = adj.GetBlockFace(); var remainder = new Vector3(AdjacentRaytrace.X - flooredAdj.X, AdjacentRaytrace.Y - flooredAdj.Y, AdjacentRaytrace.Z - flooredAdj.Z); var coordR = new BlockCoordinates(raytraceFloored); //IBlock block = null; if (!IsWorldImmutable) { var existingBlock = Level.GetBlock(coordR); bool isBlockItem = slot is ItemBlock; if (existingBlock.CanInteract && (!isBlockItem || IsSneaking)) { Network?.WorldInteraction(coordR, face, hand, remainder); return(true); } if (slot is ItemBlock ib) { BlockState blockState = ib.Block; if (blockState != null && !(blockState.Block is Air) && HasRaytraceResult) { if (existingBlock.IsReplacible || !existingBlock.Solid) { if (CanPlaceBlock(coordR, (Block)blockState.Block)) { Level.SetBlockState(coordR, blockState); Network?.BlockPlaced(coordR.BlockDown(), BlockFace.Up, hand, remainder, this); return(true); } } else { var target = new BlockCoordinates(raytraceFloored + adj); if (CanPlaceBlock(target, (Block)blockState.Block)) { Level.SetBlockState(target, blockState); Network?.BlockPlaced(coordR, face, hand, remainder, this); return(true); } } } } } if (!(slot is ItemAir) && slot.Id > 0 && slot.Count > 0) { Network?.UseItem(slot, hand); Log.Debug($"Used item!"); return(true); } } return(false); }
public async Task <bool> FinishedDigging(IPlayer player, IGrainFactory grainFactory, IWorld world, BlockWorldPos position, BlockState blockState, long usedTick) { if (!blockState.IsSameId(BlockStates.Bedrock())) { var newState = BlockStates.Air(); await world.SetBlockState(grainFactory, position, newState); // 产生 Pickup var chunk = position.ToChunkWorldPos(); var finder = grainFactory.GetGrain <ICollectableFinder>(world.MakeAddressByPartitionKey(chunk)); var blockHandler = BlockHandler.Create((BlockId)blockState.Id); var droppedSlot = blockHandler.DropBlock(ItemId, blockState); if (!droppedSlot.IsEmpty) { await finder.SpawnPickup(position + new Vector3(0.5f, 0.5f, 0.5f), new[] { droppedSlot }.AsImmutable()); } return(true); } return(false); }
public void Land() { State = BlockState.Idle; }
public override bool isValidPlaceLocation(World world, BlockPos pos, int meta, Direction clickedDirNormal, BlockState clickedBlock, Vector3 angle) { return(world.getBlock(pos.move(Direction.DOWN)).isSolid); }
/// <summary> /// Starts placing this block /// </summary> public void Place(BlockType type, BlockState newState = Data.BlockState.Placing) { this.BlockType = type; ChangeState(newState); }
public ProcessBlock(ulong blockId, BlockState state) { this.BlockId = blockId; this.State = state; }
// Change the scope state // Report an error if the token is being used in the wrong place (such as a declaration // after an executable statement). bool ChangeState(SimpleToken token) { BlockState newState = TokenToState(token); if (newState != BlockState.SUBFUNC && newState < _state) { _messages.Error(MessageCode.TOKENNOTPERMITTED, String.Format("{0} not permitted here", token)); return false; } if (newState != BlockState.UNORDERED) { _state = newState; } if (newState == BlockState.STATEMENT) { if (_currentProcedure == null) { _ls.BackToken(); _ptree.Add(KCreateProgram(_entryPointName)); return false; } } return true; }
protected override void OnCollisionResponse(IPlayer Mario, CollisionSide side) { if (this.currentState.Equals(BlockState.Idle) && side.Equals(CollisionSide.Bottom)) { if (this.numItemsLeft == ONE) { this.ChangeState(); } else { this.numItemsLeft--; } this.beingCollided = true; int curItem = items.Length - numItemsLeft; if (items != null && curItem >= ZERO && curItem < items.Length) { //If the first item is grow mushroom, then the second item must be flower. if (items[ZERO] is GrowMushroomItem) { if (((Mario)Mario).CurrentState == MarioStateMachine.MarioState.Small) { items[ZERO].Spawn(); } else { items[ONE].Spawn(); } this.numItemsLeft = ZERO; this.ChangeState(); } else { if (currentState != BlockState.Used) { this.currentState = BlockState.Bumped; preBumpPos = PosY; } items[curItem].Spawn(); } } if (this.items.Length == ZERO) { if (((Mario)Mario).CurrentState == MarioStateMachine.MarioState.Big || ((Mario)Mario).CurrentState == MarioStateMachine.MarioState.Fire) { this.currentState = BlockState.Breaking; SoundEffectFactory.Instance.PlayBrickBlock(); breakingBricks.Add(TileSpriteFactory.Instance.CreateSprite_BrickPieceLeft()); breakingBricks.Add(TileSpriteFactory.Instance.CreateSprite_BrickPieceRight()); breakingBricks.Add(TileSpriteFactory.Instance.CreateSprite_BrickPieceLeft()); breakingBricks.Add(TileSpriteFactory.Instance.CreateSprite_BrickPieceRight()); breakingBricks[ZERO].SetSpriteScreenPosition(this.Bounds.X, this.Bounds.Y); positions.Add(new Vector2(this.Bounds.X, this.Bounds.Y)); breakingBricks[ONE].SetSpriteScreenPosition(this.Bounds.X + this.Bounds.Width, this.Bounds.Y); positions.Add(new Vector2(this.Bounds.X + this.Bounds.Width, this.Bounds.Y)); breakingBricks[TWO].SetSpriteScreenPosition(this.Bounds.X, this.Bounds.Y + this.Bounds.Height); positions.Add(new Vector2(this.Bounds.X, this.Bounds.Y + this.Bounds.Height)); breakingBricks[THREE].SetSpriteScreenPosition(this.Bounds.X + this.Bounds.Width, this.Bounds.Y + this.Bounds.Height); positions.Add(new Vector2(this.Bounds.X + this.Bounds.Width, this.Bounds.Y + this.Bounds.Height)); } else if (((Mario)Mario).CurrentState == MarioStateMachine.MarioState.Small) { SoundEffectFactory.Instance.PlayBump(); this.currentState = BlockState.Bumped; preBumpPos = PosY; } } } }
public override bool CanCollide() { return(!BlockState.GetTypedValue(OPEN)); }
protected virtual void OnBlockSet(int x, int y, int z, BlockState newState, BlockState oldState) { }
public void Set(int storage, int x, int y, int z, BlockState state) { if (storage > _blockStorages.Length) { throw new IndexOutOfRangeException($"The storage id {storage} does not exist!"); } var blockCoordinates = new BlockCoordinates(x, y, z); if (state == null) { Log.Warn($"State == null"); return; } var coordsIndex = GetCoordinateIndex(x, y, z); if (storage == 0) { if (state.Block.LightValue > 0) { if (!LightSources.Contains(blockCoordinates)) { LightSources.Add(blockCoordinates); } SetBlocklight(x, y, z, (byte)state.Block.LightValue); SetBlockLightScheduled(x, y, z, true); } else { if (LightSources.Contains(blockCoordinates)) { LightSources.Remove(blockCoordinates); } } BlockState iblockstate = this.Get(x, y, z, storage); if (iblockstate != null) { Block block = iblockstate.Block; if (!(block is Air)) { --this._blockRefCount; if (block.RandomTicked) { --this._tickRefCount; } TransparentBlocks.Set(coordsIndex, true); SolidBlocks.Set(coordsIndex, false); } } OnBlockSet(x, y, z, state, iblockstate); } Block block1 = state.Block; if (storage == 0) { if (!(block1 is Air)) { ++this._blockRefCount; if (block1.RandomTicked) { ++this._tickRefCount; } TransparentBlocks.Set(coordsIndex, block1.Transparent); SolidBlocks.Set(coordsIndex, block1.Solid); } } if (state != null) { _blockStorages[storage].Set(x, y, z, state); } //ScheduledUpdates.Set(coordsIndex, true); SetScheduled(x, y, z, true); IsDirty = true; }
public void Update(GameTime gameTime) { ShowScore = false; if (State == BlockState.Active) { Move(direction, maxSlidePos); if (position == maxSlidePos) { State = BlockState.Die; if (maxSlidePos == destPosition) ShowScore = true; } } else if (State == BlockState.Return) { Move(direction * -1, oriPosition); if (position == oriPosition) State = BlockState.Ground; } if (ShowScore || time > 0) { if (ShowScore) time = 0; time += (float)gameTime.ElapsedGameTime.TotalSeconds; if (time > scoreShowTime) time = 0; } }
public void SetBlockState(int x, int y, int z, BlockState block) { SetBlockState(x, y, z, block, 0); }
public void SetBlockState(BlockCoordinates coordinates, BlockState blockState, int storage) { SetBlockState(coordinates.X, coordinates.Y, coordinates.Z, blockState, storage); }
public void SetProcessingState(ulong id, BlockState state) { var block = blocks.Find(b => b.BlockId == id); block.State = state; }
public void Create() { State = BlockState.Idle; Type = random.Next(Block.TypeCount); }
/// <summary> /// Creates a block by setting it to the idle state and specified type /// </summary> /// <param name="type">The type to set the block to</param> public void Create(int type) { State = BlockState.Idle; Type = type; }
public BlockEntry(BlockState state, int storage) { State = state; Storage = storage; }
public void Collision(GameTime gameTime, Rectangle bounds) { if (State != BlockState.Active) return; State = BlockState.Die; IsActive = false; if (direction.X != 0) { position.X = bounds.Left - direction.X * Width; } else if (direction.Y != 0) { position.Y = bounds.Top - direction.Y * Height; } if (IsSolved) ShowScore = true; if (ShowScore || time > 0) { if (ShowScore) time = 0; time += (float)gameTime.ElapsedGameTime.TotalSeconds; if (time > scoreShowTime) time = 0; } }
// Update the block depending on its state public void Update(GameTime gameTime) { switch (State) { case BlockState.Empty: break; case BlockState.Idle: break; case BlockState.Sliding: SlideTimeElapsed = SlideTimeElapsed.Add(gameTime.ElapsedGameTime); if (SlideTimeElapsed >= SlideDuration) { State = slideTargetState; Type = slideTargetType; Renderer.Scale = slideTargetRendererScale; Renderer.AnimationState = slideTargetRendererAnimationState; } break; case BlockState.WaitingToFall: fallDelayTimeElapsed = fallDelayTimeElapsed.Add(TimeSpan.FromMilliseconds(gameTime.ElapsedGameTime.TotalMilliseconds)); if (fallDelayTimeElapsed >= fallDelayDuration) { Fall(); } break; case BlockState.Falling: FallTimeElapsed = FallTimeElapsed.Add(TimeSpan.FromMilliseconds(gameTime.ElapsedGameTime.TotalMilliseconds)); if (FallTimeElapsed >= FallDuration) { if (FallTarget != null) { FallTarget.State = BlockState.Falling; FallTarget.Type = Type; FallTarget.ChainEligible = ChainEligible; FallTarget.JustFell = true; FallTarget.Renderer.Color = Renderer.Color; State = BlockState.Empty; Type = -1; ChainEligible = false; } } break; case BlockState.Matched: break; case BlockState.Flashing: FlashTimeElapsed += gameTime.ElapsedGameTime; if (FlashTimeElapsed >= FlashDuration) { WaitToPop(); } break; case BlockState.WaitingToPop: popDelayTimeElapsed = popDelayTimeElapsed.Add(TimeSpan.FromMilliseconds(gameTime.ElapsedGameTime.TotalMilliseconds)); if (popDelayTimeElapsed >= popDelayDuration) { Pop(); } break; case BlockState.Popping: PopTimeElapsed = PopTimeElapsed.Add(TimeSpan.FromMilliseconds(gameTime.ElapsedGameTime.TotalMilliseconds)); if (PopTimeElapsed >= PopDuration) { WaitToEmpty(); } break; case BlockState.WaitingToEmpty: emptyDelayTimeElapsed = emptyDelayTimeElapsed.Add(TimeSpan.FromMilliseconds(gameTime.ElapsedGameTime.TotalMilliseconds)); if (emptyDelayTimeElapsed >= emptyDelayDuration) { Empty(); } break; } Renderer.Update(gameTime); }
public void Match() { State = BlockState.Matched; }
public override BlockState BlockPlaced(World world, BlockState state, BlockCoordinates position) { return(base.BlockPlaced(world, state, position)); }
/// <summary> /// Changes the state /// </summary> /// <param name="newState"></param> private void ChangeState(BlockState newState) { this.BlockState = newState; if (_fxBody != null) UpdateFx(); _stateTime = 0; OnStateChanged.Invoke(new BlockStateArgs(this, newState)); }
public void WaitToPop() { State = BlockState.WaitingToPop; popDelayTimeElapsed = TimeSpan.Zero; }
/// Compile an array of source lines. void CompileString(string filename, string[] lines) { try { _parsingIf = false; _blockDepth = 0; _state = BlockState.NONE; // Create the top-level program node. if (_programDef == null) { string moduleName = Path.GetFileNameWithoutExtension(_opts.OutputFile); if (string.IsNullOrEmpty(moduleName)) { moduleName = "Class"; } _programDef = new ProgramDefinition(); _programDef.Name = moduleName; _programDef.Globals = _globalSymbols; _programDef.IsExecutable = true; _programDef.Root = _ptree; } CompileUnit(filename, lines); // Dump file? if (_opts.Dump) { XmlDocument xmlTree = ParseTreeXML.Tree(_programDef); string outputFilename = Path.GetFileName(_opts.OutputFile); outputFilename = Path.ChangeExtension(outputFilename, ".xml"); xmlTree.Save(outputFilename); } } catch (Exception e) { if (_opts.DevMode) { throw; } _messages.Error(MessageCode.COMPILERFAILURE, String.Format("Compiler error: {0}", e.Message)); } }
public void WaitToEmpty() { State = BlockState.WaitingToEmpty; emptyDelayTimeElapsed = TimeSpan.Zero; }
public BlockRequest(BlockState blockState, BitcoinEndpoint endpoint, DateTime requestDate) { this.BlockState = blockState; this.Endpoint = endpoint; this.RequestDate = requestDate; }
public void Empty() { State = BlockState.Empty; Type = -1; JustEmptied = true; }
public BaseState GetGameBaseState(GameObject baseObject, float maxDistanceFromBase) { var blockStates = new List<BlockState>(); // Get all blocks of that base foreach (Transform childTransform in baseObject.transform) { if (childTransform.gameObject.tag == "BaseMarker") { continue; } var bObj = childTransform.gameObject; // Skip blocks that are too far from the base if (bObj.transform.localPosition.magnitude > maxDistanceFromBase) { continue; } var bState = new BlockState(); bState.blockType = BlockState.GetBlockType(bObj.name); bState.x = bObj.transform.localPosition.x; bState.y = bObj.transform.localPosition.y; bState.z = bObj.transform.localPosition.z; bState.qx = bObj.transform.localRotation.x; bState.qy = bObj.transform.localRotation.y; bState.qz = bObj.transform.localRotation.z; bState.qw = bObj.transform.localRotation.w; blockStates.Add(bState); } var baseState = new BaseState(); baseState.blockStates = blockStates.ToArray(); return baseState; }
public void Raise(Block targetBlock) { State = targetBlock.State; Type = targetBlock.Type; }