public void DiggingPostConstructor() { _placeBlockCursor = InstanceProvider.GetInstance <BlockMarker>(); _placeBlockCursor.Init("BuildCursor", WorldSettings.BuildMaterial); _placeBlockCursor.SetBlockId((byte)InventoryModel.SelectedBlockType); _mineBlockCursor = InstanceProvider.GetInstance <BlockMarker>(); _mineBlockCursor.Init("MineCursor", WorldSettings.MineMaterial); _mineBlockCursor.SetMiningProgress(0); Updater.EveryFrame(UpdateCursorBlocks); Updater.EveryFrame(UpdateMining); BlockTypeSelectedSignal.AddListener(BlockTypeSelectedHandler); }
public void ReceiveHit(b_Character attacker, int damage) { //TODO Add activation of passive abilities with call on hit if (blockMarkers.Count > 0) { BlockMarker marker = ((BlockMarker)blockMarkers[0]); marker.ExecuteDamage(damage, this, attacker); if (marker.HitsLeft == 0) { blockMarkers.Remove(marker); } } else { AddHealth(-damage); } }
private void _read() { _blockType = ((CreativeVoiceFile.BlockTypes)m_io.ReadU1()); if (BlockType != CreativeVoiceFile.BlockTypes.Terminator) { _bodySize1 = m_io.ReadU2le(); } if (BlockType != CreativeVoiceFile.BlockTypes.Terminator) { _bodySize2 = m_io.ReadU1(); } if (BlockType != CreativeVoiceFile.BlockTypes.Terminator) { switch (BlockType) { case CreativeVoiceFile.BlockTypes.SoundDataNew: { __raw_body = m_io.ReadBytes(BodySize); var io___raw_body = new KaitaiStream(__raw_body); _body = new BlockSoundDataNew(io___raw_body, this, m_root); break; } case CreativeVoiceFile.BlockTypes.RepeatStart: { __raw_body = m_io.ReadBytes(BodySize); var io___raw_body = new KaitaiStream(__raw_body); _body = new BlockRepeatStart(io___raw_body, this, m_root); break; } case CreativeVoiceFile.BlockTypes.Marker: { __raw_body = m_io.ReadBytes(BodySize); var io___raw_body = new KaitaiStream(__raw_body); _body = new BlockMarker(io___raw_body, this, m_root); break; } case CreativeVoiceFile.BlockTypes.SoundData: { __raw_body = m_io.ReadBytes(BodySize); var io___raw_body = new KaitaiStream(__raw_body); _body = new BlockSoundData(io___raw_body, this, m_root); break; } case CreativeVoiceFile.BlockTypes.ExtraInfo: { __raw_body = m_io.ReadBytes(BodySize); var io___raw_body = new KaitaiStream(__raw_body); _body = new BlockExtraInfo(io___raw_body, this, m_root); break; } case CreativeVoiceFile.BlockTypes.Silence: { __raw_body = m_io.ReadBytes(BodySize); var io___raw_body = new KaitaiStream(__raw_body); _body = new BlockSilence(io___raw_body, this, m_root); break; } default: { _body = m_io.ReadBytes(BodySize); break; } } } }
//-------------------------------------------------------------- #region Methods //-------------------------------------------------------------- private void UpdateBracketHighlighting() { if (_bracketMarkerRenderer == null) { return; } var markers = _bracketMarkerRenderer.Markers; // Remove old markers. markers.Clear(); if (!EnableBracketHighlighting || (BracketHighlightingBrush == null && BracketHighlightingPen == null)) { return; } // See if we are after at closing bracket. if (CaretOffset >= 2) { // Get character before caret. var previousChar = Document.GetCharAt(CaretOffset - 1); int bracketIndex = Array.IndexOf(ClosingBrackets, previousChar); if (bracketIndex >= 0) { // Caret is after a closing bracket. // Find matching opening bracket. int openingBracketOffset = TextUtilities.FindOpeningBracket( Document, CaretOffset - 2, OpeningBrackets[bracketIndex], ClosingBrackets[bracketIndex]); if (openingBracketOffset >= 0) { // Opening bracket found. Mark both brackets. var openBracketMarker0 = new BlockMarker { StartOffset = openingBracketOffset, Length = 1, Brush = BracketHighlightingBrush, Pen = BracketHighlightingPen }; var closeBracketMarker0 = new BlockMarker { StartOffset = CaretOffset - 1, Length = 1, Brush = BracketHighlightingBrush, Pen = BracketHighlightingPen }; markers.Add(openBracketMarker0); markers.Add(closeBracketMarker0); } } } // See if we are before an opening bracket. if (Document != null && CaretOffset < Document.TextLength - 1) { // Get character before caret. var nextChar = Document.GetCharAt(CaretOffset); int bracketIndex = Array.IndexOf(OpeningBrackets, nextChar); if (bracketIndex >= 0) { // Caret is before an opening bracket. // Find matching opening bracket. int closingBracketOffset = TextUtilities.FindClosingBracket( Document, CaretOffset + 1, OpeningBrackets[bracketIndex], ClosingBrackets[bracketIndex]); if (closingBracketOffset >= 0) { // Opening bracket found. Mark both brackets. var openBracketMarker1 = new BlockMarker { StartOffset = CaretOffset, Length = 1, Brush = BracketHighlightingBrush, Pen = BracketHighlightingPen }; var closeBracketMarker1 = new BlockMarker { StartOffset = closingBracketOffset, Length = 1, Brush = BracketHighlightingBrush, Pen = BracketHighlightingPen }; markers.Add(openBracketMarker1); markers.Add(closeBracketMarker1); } } } }
public void AddBlockMarker(BlockMarker marker) { blockMarkers.Add(marker); }