internal static void ExecuteCycle(Clock clock, float deltaTime = 0f) { if (clock != null) { var currentMsUpdate = clock.GetElapsedSeconds(); if (currentMsUpdate == 0) { Thread.Sleep(1); currentMsUpdate = clock.GetElapsedSeconds(); } Script.DeltaTime = (float)currentMsUpdate; clock.Reset(); } else { Script.DeltaTime = deltaTime; } lock (RtUpdate) { RtUpdate?.Invoke(); } lock (Updating) { Updating?.Invoke(); } lock (Destroying) { Destroying?.Invoke(); } }
public void Destroy() { spriteRenderer.enabled = false; particles.Play(); Destroying?.Invoke(); Destroy(gameObject, particles.main.duration + particles.main.startLifetimeMultiplier); }
protected override void Dispose(bool disposing) { if (disposing) { Destroying?.Invoke(this, null); } base.Dispose(disposing); }
public void DestroySelf() { ScoreManager.Instance.IncreaseScore(); IsDestroying = true; Destroying?.Invoke(); particles.Play(); StartCoroutine(ReturnToSpawner(particles.main.duration)); }
private IEnumerator ReturnToSpawnPoint() { while (Vector3.Distance(SpawnPoint.position, transform.position) > 0.5f) { var direction = (SpawnPoint.position - transform.position).normalized; rb.MovePosition(transform.position + direction * Time.fixedDeltaTime * ThrowingSpeed); yield return(new WaitForFixedUpdate()); } Destroying?.Invoke(); Destroy(gameObject); }
private IEnumerator BringCrateToSpawnPoint(Collision2D collision) { while (Vector3.Distance(SpawnPoint.position, transform.position) > 0.5f) { var direction = (SpawnPoint.position - transform.position).normalized; rb.MovePosition(transform.position + direction * Time.fixedDeltaTime * ThrowingSpeed); collision.transform.Translate(direction * Time.fixedDeltaTime * ThrowingSpeed); yield return(new WaitForFixedUpdate()); } var points = collision.gameObject.GetComponent <Crate>().Points; ScoreManager.Instance.IncreaseScoreBy(points); collision.gameObject.GetComponent <Crate>().Destroy(); Destroying?.Invoke(); Destroy(gameObject); }
public void DestroyAll(bool destroyTemplate = true) { lock (syncObject) { if (itemList.Count == 0) { return; } RecycleAll(); for (int i = 0; i < itemList.Count; ++i) { PoolItem item = itemList[i]; if (item.instance != null) { item.poolItem?.OnDestroying(); Destroying?.Invoke(item.instance); DestroyImpl(item.instance); } } if (itemList != null) { itemList.Clear(); itemList.Capacity = 0; } if (destroyTemplate && Template != null) { DestroyImpl(Template); Template = null; } version++; residueCount = 0; } }
public void ChangeState(TileState state) { switch (state) { case TileState.Destroy: { TileState stateBeforeDestroy = this.State; if (Type == TileType.Bomb || Type == TileType.HorizontalLine || Type == TileType.VerticalLine) { stateBeforeDestroy = TileState.Idle; } this.State = TileState.Destroy; Destroying?.Invoke(this, new TileEventArgs(PositionOnScreen, Type, stateBeforeDestroy, PositionConverter.GetCellByTilePosition(PositionOnScreen))); break; } default: { this.State = state; break; } } }
/// <summary> /// Called before destroying a player. /// </summary> /// <param name="ev">The <see cref="DestroyingEventArgs"/> instance.</param> public static void OnDestroying(DestroyingEventArgs ev) => Destroying.InvokeSafely(ev);
private void OnDestroy() { Destroying?.Invoke(gameObject); }
public ItemTypeEnum GiveMeYourPowers() { Destroying?.Invoke(); Destroy(this.gameObject); return(ItemType); }
void IForceDestroyer.ForceDestroy() { Destroying?.Invoke(); Destroy(this.gameObject); }
/// <summary> /// Kun oliota käydään tuhoamaan /// </summary> protected void OnDestroying() { Destroying?.Invoke(); }
public void SurfaceDestroyed(ISurfaceHolder holder) { Destroying?.Invoke(this, EventArgs.Empty); }
public void OnContextDestroy() { Destroying?.Invoke(); }
protected override void OnDestroy() { base.OnDestroy(); Destroying?.Invoke(this, EventArgs.Empty); }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { Destroying?.Invoke(this, EventArgs.Empty); }