public void Hit(float damage) { if (broken) { return; } hp -= damage; OnHit?.Invoke(); if (hp < HP_LOW_THRESHOLD) { OnBreak?.Invoke(); if (doDestroyOnBreak) { Destroy(gameObject); } if (breakFXPrefab != null) { Instantiate(breakFXPrefab, transform.position, Quaternion.identity); } hp = 0; broken = true; } }
public void DoBreak(string input, OnBreak onbreak) { IsCanceled = false;//reset char[] charBuff = input.ToCharArray(); //to end DoBreak(charBuff, 0, charBuff.Length, onbreak); }
public void DoBreak(string input, OnBreak onbreak) { IsCanceled = false;//reset char[] charBuff = input.ToCharArray(); //to end DoBreak(charBuff, 0, charBuff.Length, onbreak); }
public void DoBreak(string input, int start, int len, OnBreak onbreak) { IsCanceled = false;//reset char[] charBuff = input.ToCharArray(); // DoBreak(charBuff, start, len, onbreak); }
public void Init(OnHit on_hit, OnBreak on_break, float speed, float max_travel_distance) { Init(on_hit); this.on_break = on_break; this.speed = speed; max_distance = max_travel_distance; }
public void DoBreak(string input, int start, int len, OnBreak onbreak) { IsCanceled = false;//reset char[] charBuff = input.ToCharArray(); // DoBreak(charBuff, start, len, onbreak); }
public void CleanBreak() { ParticleSystem tempPs = Instantiate(ps); tempPs.transform.position = this.transform.position; tempPs.Play(); sfxSet.Play(); OnBreak?.Invoke(); }
private IEnumerator WaitAndBreakNext(float time) { yield return(new WaitForSeconds(time)); OnBreak?.Invoke(); _currentPuzzle = _puzzlesQueue.Dequeue(); _currentPuzzle.Break(); _currentPuzzle.OnFix += FixPuzzle; _solvedPuzzles.Add(_currentPuzzle); }
public override void Exit() { base.Exit(); if (hasBroken) { scoreMultiplier.ApplyChange(multipliers.comboMultiplier); OnBreak?.Invoke(); } breakableList.Clear(); pendingBlocks.Clear(); }
public int OnModeChange(DBGMODE dbgmodeNew) { if (dbgmodeNew == DBGMODE.DBGMODE_Break) { OnBreak?.Invoke(); } else if (dbgmodeNew == DBGMODE.DBGMODE_Design) { OnDebugEnd?.Invoke(); } return(VSConstants.S_OK); }
public void CleanBreak() { IBreakable breakable; for (int i = 0; i < blocks.Count; i++) { breakable = blocks[i].breakable; breakable.CleanBreak(); } OnBreak?.Invoke(); }
public void Shatter(int delayMultiplier, bool sound = true) { Shattering = true; ShatterCountdown = delayMultiplier * BreakDelayAdd; pitchMultiplier = Mathf.Pow(9f / 8, delayMultiplier); mover.Locked = true; OnBreak?.Invoke(); shatterSound = sound; Destroy(chainIndicator); }
public void Break() { BeforeBreak?.Invoke(); IBreakable breakable; for (int i = 0; i < blocks.Count; i++) { breakable = blocks[i].breakable; breakable.Break(); } OnBreak?.Invoke(); }
public void Break() { BeforeBreak?.Invoke(); ParticleSystem tempPs = Instantiate(ps); tempPs.transform.position = this.transform.position; tempPs.Play(); sfxSet.Play(); breakCount.ApplyChange(1); CameraShaker.Instance.ShakeOnce(Magnitude, Roughness, 0, FadeOutTime); OnBreak?.Invoke(); }
public override void DoBreak(char[] input, int start, int len, OnBreak onbreak) { //1. UBreakIteratorType type = UBreakIteratorType.WORD; switch (BreakKind) { default: case TextBreakKind.Word: type = UBreakIteratorType.WORD; break; case TextBreakKind.Sentence: type = UBreakIteratorType.SENTENCE; break; } //------------------------ int errCode = 0; //break all string unsafe { fixed(char *h = &input[start]) { IntPtr nativeIter = NativeTextBreakerLib.MtFt_UbrkOpen(type, localebuff, h, len, out errCode); int cur = NativeTextBreakerLib.MtFt_UbrkFirst(nativeIter); while (cur != DONE) { int next = NativeTextBreakerLib.MtFt_UbrkNext(nativeIter); int status = NativeTextBreakerLib.MtFt_UbrkGetRuleStatus(nativeIter); if (next != DONE && AddToken(type, status)) { onbreak(new SplitBound(cur, next - cur)); } cur = next; } NativeTextBreakerLib.MtFt_UbrkClose(nativeIter); } } }
private void BreakOnHit() { GameObject instantiatedBrokenVersion = Instantiate(brokenVersion, transform.position, transform.rotation); OnBreak?.Invoke(instantiatedBrokenVersion); if (fadeAwayAfterBreaking) { ObjectFader objectFader = instantiatedBrokenVersion.GetComponent <ObjectFader>(); if (objectFader) { objectFader.FadeToTransparent(secondsLater: destroyInSeconds, destroyAfter: true); } } Rigidbody[] rigidbodies = instantiatedBrokenVersion.GetComponentsInChildren <Rigidbody>(); foreach (Rigidbody r in rigidbodies) { r.AddExplosionForce(explosionForce, transform.position, 1f); } Destroy(gameObject); }
private void OnComboChanged(int combo) { if (combo == prev_combo) { return; } if (combo < prev_combo) { combo_level = 0; OnBreak?.Invoke(Math.Abs(combo - prev_combo)); } else { if (combo >= (combo_level + 1) * COMBO_RANK_DEFAULT) { combo_level++; OnComboRankUp?.Invoke(combo_level); } } prev_combo = combo; }
public override void DoBreak(char[] input, int start, int len, OnBreak onbreak) { //1. UBreakIteratorType type = UBreakIteratorType.WORD; switch (BreakKind) { default: case TextBreakKind.Word: type = UBreakIteratorType.WORD; break; case TextBreakKind.Sentence: type = UBreakIteratorType.SENTENCE; break; } //------------------------ int errCode = 0; //break all string unsafe { fixed (char* h = &input[start]) { IntPtr nativeIter = NativeTextBreakerLib.MtFt_UbrkOpen(type, localebuff, h, len, out errCode); int cur = NativeTextBreakerLib.MtFt_UbrkFirst(nativeIter); while (cur != DONE) { int next = NativeTextBreakerLib.MtFt_UbrkNext(nativeIter); int status = NativeTextBreakerLib.MtFt_UbrkGetRuleStatus(nativeIter); if (next != DONE && AddToken(type, status)) { onbreak(new SplitBound(cur, next - cur)); } cur = next; } NativeTextBreakerLib.MtFt_UbrkClose(nativeIter); } } }
private void InitCallbacks() { m_callbacksArray = new Dictionary <ManagedCallbackType, DebugEventHandler <CorEventArgs> > { { ManagedCallbackType.OnBreakpoint, (sender, args) => OnBreakpoint?.Invoke(sender, (BreakpointEventArgs)args) }, { ManagedCallbackType.OnStepComplete, (sender, args) => OnStepComplete?.Invoke(sender, (StepCompleteEventArgs)args) }, { ManagedCallbackType.OnBreak, (sender, args) => OnBreak?.Invoke(sender, (ThreadEventArgs)args) }, { ManagedCallbackType.OnException, (sender, args) => OnException?.Invoke(sender, (ExceptionEventArgs)args) }, { ManagedCallbackType.OnEvalComplete, (sender, args) => OnEvalComplete?.Invoke(sender, (EvalEventArgs)args) }, { ManagedCallbackType.OnEvalException, (sender, args) => OnEvalException?.Invoke(sender, (EvalEventArgs)args) }, { ManagedCallbackType.OnCreateProcess, (sender, args) => OnCreateProcess?.Invoke(sender, (ProcessEventArgs)args) }, { ManagedCallbackType.OnProcessExit, (sender, args) => OnProcessExit?.Invoke(sender, (ProcessEventArgs)args) }, { ManagedCallbackType.OnCreateThread, (sender, args) => OnCreateThread?.Invoke(sender, (ThreadEventArgs)args) }, { ManagedCallbackType.OnThreadExit, (sender, args) => OnThreadExit?.Invoke(sender, (ThreadEventArgs)args) }, { ManagedCallbackType.OnModuleLoad, (sender, args) => OnModuleLoad?.Invoke(sender, (ModuleEventArgs)args) }, { ManagedCallbackType.OnModuleUnload, (sender, args) => OnModuleUnload?.Invoke(sender, (ModuleEventArgs)args) }, { ManagedCallbackType.OnClassLoad, (sender, args) => OnClassLoad?.Invoke(sender, (ClassEventArgs)args) }, { ManagedCallbackType.OnClassUnload, (sender, args) => OnClassUnload?.Invoke(sender, (ClassEventArgs)args) }, { ManagedCallbackType.OnDebuggerError, (sender, args) => OnDebuggerError?.Invoke(sender, (DebuggerErrorEventArgs)args) }, { ManagedCallbackType.OnLogMessage, (sender, args) => OnLogMessage?.Invoke(sender, (LogMessageEventArgs)args) }, { ManagedCallbackType.OnLogSwitch, (sender, args) => OnLogSwitch?.Invoke(sender, (LogSwitchEventArgs)args) }, { ManagedCallbackType.OnCreateAppDomain, (sender, args) => OnCreateAppDomain?.Invoke(sender, (AppDomainEventArgs)args) }, { ManagedCallbackType.OnAppDomainExit, (sender, args) => OnAppDomainExit?.Invoke(sender, (AppDomainEventArgs)args) }, { ManagedCallbackType.OnAssemblyLoad, (sender, args) => OnAssemblyLoad?.Invoke(sender, (AssemblyEventArgs)args) }, { ManagedCallbackType.OnAssemblyUnload, (sender, args) => OnAssemblyUnload?.Invoke(sender, (AssemblyEventArgs)args) }, { ManagedCallbackType.OnControlCTrap, (sender, args) => OnControlCTrap?.Invoke(sender, (ProcessEventArgs)args) }, { ManagedCallbackType.OnNameChange, (sender, args) => OnNameChange?.Invoke(sender, (ThreadEventArgs)args) }, { ManagedCallbackType.OnUpdateModuleSymbols, (sender, args) => OnUpdateModuleSymbols?.Invoke(sender, (UpdateModuleSymbolsEventArgs)args) }, { ManagedCallbackType.OnFunctionRemapOpportunity, (sender, args) => OnFunctionRemapOpportunity?.Invoke(sender, (FunctionRemapOpportunityEventArgs)args) }, { ManagedCallbackType.OnFunctionRemapComplete, (sender, args) => OnFunctionRemapComplete?.Invoke(sender, (FunctionRemapCompleteEventArgs)args) }, { ManagedCallbackType.OnBreakpointSetError, (sender, args) => OnBreakpointSetError?.Invoke(sender, (BreakpointEventArgs)args) }, { ManagedCallbackType.OnException2, (sender, args) => OnException2?.Invoke(sender, (Exception2EventArgs)args) }, { ManagedCallbackType.OnExceptionUnwind2, (sender, args) => OnExceptionUnwind2?.Invoke(sender, (ExceptionUnwind2EventArgs)args) }, { ManagedCallbackType.OnMDANotification, (sender, args) => OnMDANotification?.Invoke(sender, (MDAEventArgs)args) }, { ManagedCallbackType.OnExceptionInCallback, (sender, args) => OnExceptionInCallback?.Invoke(sender, (ExceptionInCallbackEventArgs)args) }, }; }
public void DoBreak(char[] charBuff, OnBreak onbreak) { IsCanceled = false;//reset //to end DoBreak(charBuff, 0, charBuff.Length, onbreak); }
void DoBreak(WordVisitor visitor, char[] input, int start, int len, OnBreak onbreak) { //---------------------------------------- //simple break word/ num/ punc / space //similar to lexer function //---------------------------------------- LexState lexState = LexState.Init; int endBefore = start + len; char first = (char)1; char last = (char)255; for (int i = start; i < endBefore; ++i) { char c = input[i]; if (c < first || c > last) { //clear accum state if (i > start) { //some remaining data breakBounds.length = i - breakBounds.startIndex; onbreak(breakBounds); } visitor.State = VisitorState.OutOfRangeChar; return; } switch (lexState) { case LexState.Init: { //check char if (c == '\r') { //check next if '\n' if (i < endBefore - 1) { if (input[i + 1] == '\n') { //this is '\r\n' linebreak breakBounds.startIndex = i; breakBounds.length = 2; breakBounds.kind = WorkKind.NewLine; onbreak(breakBounds); breakBounds.length = 0; lexState = LexState.Init; i++; continue; } } else { //sinple \r? //to whitespace? lexState = LexState.Whitespace; breakBounds.startIndex = i; } } else if (c == '\n') { breakBounds.startIndex = i; breakBounds.length = 1; breakBounds.kind = WorkKind.NewLine; onbreak(breakBounds); breakBounds.length = 0; lexState = LexState.Init; continue; } else if (char.IsLetter(c)) { //just collect breakBounds.startIndex = i; breakBounds.kind = WorkKind.Text; lexState = LexState.Text; } else if (char.IsNumber(c)) { breakBounds.startIndex = i; breakBounds.kind = WorkKind.Number; lexState = LexState.Number; } else if (char.IsWhiteSpace(c)) { //we collect whitespace breakBounds.startIndex = i; breakBounds.kind = WorkKind.Whitespace; lexState = LexState.Whitespace; } else if (char.IsPunctuation(c) || char.IsSymbol(c)) { breakBounds.startIndex = i; breakBounds.length = 1; breakBounds.kind = WorkKind.Punc; //we not collect punc onbreak(breakBounds); breakBounds.startIndex += 1; breakBounds.length = 0; lexState = LexState.Init; continue; } else { throw new System.NotSupportedException(); } } break; case LexState.Number: { //in number state if (!char.IsNumber(c)) { //if number then continue collect //if not //flush current state breakBounds.length = i - breakBounds.startIndex; onbreak(breakBounds); breakBounds.length = 0; lexState = LexState.Init; goto case LexState.Init; } } break; case LexState.Text: { if (!char.IsLetter(c)) { //flush breakBounds.length = i - breakBounds.startIndex; onbreak(breakBounds); breakBounds.length = 0; lexState = LexState.Init; goto case LexState.Init; } } break; case LexState.Whitespace: { if (!char.IsWhiteSpace(c)) { breakBounds.length = i - breakBounds.startIndex; onbreak(breakBounds); breakBounds.length = 0; lexState = LexState.Init; goto case LexState.Init; } } break; } } if (breakBounds.startIndex < start + len) { //some remaining data breakBounds.length = (start + len) - breakBounds.startIndex; onbreak(breakBounds); visitor.State = VisitorState.End; } }
public abstract void DoBreak(char[] input, int start, int len, OnBreak onbreak);
public void Break() { InputConnector.RemoveConnection(this); OutputConnector.RemoveConnection(this); OnBreak?.Invoke(this, new EventArgs()); }
void DoBreak(WordVisitor visitor, char[] input, int start, int len, OnBreak onBreak) { //---------------------------------------- //simple break word/ num/ punc / space //similar to lexer function //---------------------------------------- int endBefore = start + len; if (endBefore > input.Length) { throw new System.ArgumentOutOfRangeException(nameof(len), len, "The range provided was partially out of bounds."); } else if (start < 0) { throw new System.ArgumentOutOfRangeException(nameof(start), start, "The starting index was negative."); } //throw instead of skipping the entire for loop else if (len < 0) { throw new System.ArgumentOutOfRangeException(nameof(len), len, "The length provided was negative."); } //---------------------------------------- LexState lexState = LexState.Init; breakBounds.startIndex = start; char first = (char)0; char last = (char)255; for (int i = start; i < endBefore; ++i) { char c = input[i]; switch (lexState) { case LexState.Init: { //check char if (c == '\r' && i < endBefore - 1 && input[i + 1] == '\n') { //this is '\r\n' linebreak breakBounds.startIndex = i; breakBounds.length = 2; breakBounds.kind = WordKind.NewLine; // onBreak(breakBounds); // breakBounds.length = 0; lexState = LexState.Init; i++; continue; } else if (c == '\r' || c == '\n' || c == 0x85) //U+0085 NEXT LINE { breakBounds.startIndex = i; breakBounds.length = 1; breakBounds.kind = WordKind.NewLine; // onBreak(breakBounds); // breakBounds.length = 0; lexState = LexState.Init; continue; } else if (char.IsLetter(c)) { if (c < first || c > last) { //letter is out-of-range or not //clear accum state if (i > breakBounds.startIndex) { //some remaining data breakBounds.length = i - breakBounds.startIndex; // onBreak(breakBounds); // } visitor.State = VisitorState.OutOfRangeChar; return; } //------------------ //just collect breakBounds.startIndex = i; breakBounds.kind = WordKind.Text; lexState = LexState.Text; } else if (char.IsNumber(c)) { breakBounds.startIndex = i; breakBounds.kind = WordKind.Number; lexState = LexState.Number; } else if (char.IsWhiteSpace(c)) { //we collect whitespace breakBounds.startIndex = i; breakBounds.kind = WordKind.Whitespace; lexState = LexState.Whitespace; } else if (char.IsPunctuation(c) || char.IsSymbol(c)) { //for eng - if (c == '-') { //check next char is number or not if (i < endBefore - 1 && char.IsNumber(input[i + 1])) { breakBounds.startIndex = i; breakBounds.kind = WordKind.Number; lexState = LexState.Number; continue; } } breakBounds.startIndex = i; breakBounds.length = 1; breakBounds.kind = WordKind.Punc; //we not collect punc onBreak(breakBounds); // breakBounds.startIndex += 1; breakBounds.length = 0; lexState = LexState.Init; continue; } else if (char.IsControl(c)) { breakBounds.startIndex = i; breakBounds.length = 1; breakBounds.kind = WordKind.Control; // onBreak(breakBounds); // breakBounds.length = 0; lexState = LexState.Init; continue; } else if (char.IsHighSurrogate(c)) { if (i < endBefore - 1 && //not the last one char.IsLowSurrogate(input[i + 1])) { //surrogate pair //clear accum state if (i > breakBounds.startIndex) { //some remaining data breakBounds.length = i - breakBounds.startIndex; // onBreak(breakBounds); } //------------------------------- //surrogate pair breakBounds.startIndex = i; breakBounds.length = 2; onBreak(breakBounds); //------------------------------- i++; //consume next*** breakBounds.startIndex = i + 1; //reset breakBounds.length = 0; //reset lexState = LexState.Init; continue; //*** } else { //error throw new System.FormatException($"A high surrogate (U+{((ushort)c).ToString("X4")}) was not followed by a low surrogate."); } } else if (c < first || c > last) { //letter is out-of-range or not //clear accum state if (i > breakBounds.startIndex) { //some remaining data breakBounds.length = i - breakBounds.startIndex; // onBreak(breakBounds); // } visitor.State = VisitorState.OutOfRangeChar; return; } else { throw new System.NotSupportedException($"The character {c} (U+{((ushort)c).ToString("X4")}) was unhandled."); } } break; case LexState.Number: { //in number state if (!char.IsNumber(c) && c != '.') { //if number then continue collect //if not //flush current state breakBounds.length = i - breakBounds.startIndex; breakBounds.kind = WordKind.Number; // onBreak(breakBounds); // breakBounds.length = 0; breakBounds.startIndex = i; lexState = LexState.Init; goto case LexState.Init; } } break; case LexState.Text: { if (!char.IsLetter(c) && !char.IsNumber(c)) { //flush existing text breakBounds.length = i - breakBounds.startIndex; breakBounds.kind = WordKind.Text; // onBreak(breakBounds); // breakBounds.length = 0; breakBounds.startIndex = i; lexState = LexState.Init; goto case LexState.Init; } else { //c may be out-of-range letter //letter is out-of-range or not //clear accum state if (c < first || c > last) { if (i > breakBounds.startIndex) { //flush breakBounds.length = i - breakBounds.startIndex; breakBounds.kind = WordKind.Text; // onBreak(breakBounds); // } visitor.State = VisitorState.OutOfRangeChar; return; } } } break; case LexState.Whitespace: { if (!char.IsWhiteSpace(c)) { breakBounds.length = i - breakBounds.startIndex; breakBounds.kind = WordKind.Whitespace; // onBreak(breakBounds); // breakBounds.length = 0; breakBounds.startIndex = i; lexState = LexState.Init; goto case LexState.Init; } } break; } } if (lexState != LexState.Init && breakBounds.startIndex < start + len) { //some remaining data breakBounds.length = (start + len) - breakBounds.startIndex; // onBreak(breakBounds); // } visitor.State = VisitorState.End; }
public void handleBreak(ushort offset, IState state) => OnBreak?.Invoke(offset, state, debugSymbols);
public void handleBreak(ushort offset, CPU cpu) => OnBreak?.Invoke(offset, cpu, debugSymbols);
public void Break() => OnBreak?.Invoke();
public void DoBreak(char[] charBuff, OnBreak onbreak) { IsCanceled = false;//reset //to end DoBreak(charBuff, 0, charBuff.Length, onbreak); }
public abstract void DoBreak(char[] input, int start, int len, OnBreak onbreak);
public void Init(OnHit on_hit, OnBreak on_break) { Init(on_hit); this.on_break = on_break; }
void DoBreak(WordVisitor visitor, char[] input, int start, int len, OnBreak onbreak) { //---------------------------------------- //simple break word/ num/ punc / space //similar to lexer function //---------------------------------------- LexState lexState = LexState.Init; int endBefore = start + len; char first = (char)1; char last = (char)255; for (int i = start; i < endBefore; ++i) { char c = input[i]; if (c < first || c > last) { //clear accum state if (i > start) { //some remaining data breakBounds.length = i - breakBounds.startIndex; onbreak(breakBounds); } visitor.State = VisitorState.OutOfRangeChar; return; } switch (lexState) { case LexState.Init: { //check char if (c == '\r') { //check next if '\n' if (i < endBefore - 1) { if (input[i + 1] == '\n') { //this is '\r\n' linebreak breakBounds.startIndex = i; breakBounds.length = 2; breakBounds.kind = WorkKind.NewLine; onbreak(breakBounds); breakBounds.length = 0; lexState = LexState.Init; i++; continue; } } else { //sinple \r? //to whitespace? lexState = LexState.Whitespace; breakBounds.startIndex = i; } } else if (c == '\n') { breakBounds.startIndex = i; breakBounds.length = 1; breakBounds.kind = WorkKind.NewLine; onbreak(breakBounds); breakBounds.length = 0; lexState = LexState.Init; continue; } else if (char.IsLetter(c)) { //just collect breakBounds.startIndex = i; breakBounds.kind = WorkKind.Text; lexState = LexState.Text; } else if (char.IsNumber(c)) { breakBounds.startIndex = i; breakBounds.kind = WorkKind.Number; lexState = LexState.Number; } else if (char.IsWhiteSpace(c)) { //we collect whitespace breakBounds.startIndex = i; breakBounds.kind = WorkKind.Whitespace; lexState = LexState.Whitespace; } else if (char.IsPunctuation(c) || char.IsSymbol(c)) { breakBounds.startIndex = i; breakBounds.length = 1; breakBounds.kind = WorkKind.Punc; //we not collect punc onbreak(breakBounds); breakBounds.startIndex += 1; breakBounds.length = 0; lexState = LexState.Init; continue; } else { throw new System.NotSupportedException(); } } break; case LexState.Number: { //in number state if (!char.IsNumber(c)) { //if number then continue collect //if not //flush current state breakBounds.length = i - breakBounds.startIndex; onbreak(breakBounds); breakBounds.length = 0; lexState = LexState.Init; goto case LexState.Init; } } break; case LexState.Text: { if (!char.IsLetter(c)) { //flush breakBounds.length = i - breakBounds.startIndex; onbreak(breakBounds); breakBounds.length = 0; lexState = LexState.Init; goto case LexState.Init; } } break; case LexState.Whitespace: { if (!char.IsWhiteSpace(c)) { breakBounds.length = i - breakBounds.startIndex; onbreak(breakBounds); breakBounds.length = 0; lexState = LexState.Init; goto case LexState.Init; } } break; } } if (breakBounds.startIndex < start + len) { //some remaining data breakBounds.length = (start + len) - breakBounds.startIndex; onbreak(breakBounds); visitor.State = VisitorState.End; } }