public void DiscardInstantiatedPrefab() { if (_placingType == PlacingManager.PlacingType.instantiate) { Destroy(AssociatedGO); AssociatedGO = null; } else { if (AssociatedGO == null) { return; } foreach (Transform tr in AssociatedGO.transform) { tr.gameObject.SetActive(false); } IRestartable restartComponent = AssociatedGO.GetComponent <IRestartable>(); if (restartComponent != null) { restartComponent.Restart(); } AssociatedGO = null; } }
async Task AttemptRestart(IRestartable restartable, int attempt, Exception error) { attempt += 1; // quite if there are no more delays in the sequence if (!_delays.MoveNext()) { await restartable.MaxRestartsReached(attempt); return; } // attempt another restart TimeSpan delay = _delays.Current; Debug.Assert(delay > TimeSpan.Zero); await restartable.PauseBeforeRestart(delay); try { await restartable.Restart(); } catch (Exception ex) { Logging.Log.Warning("Failed to restart: " + ex); return; } Monitor(restartable, attempt); }
private GameObject SpawnObjectInternal(string name, Transform transform) { if (!Objects.ContainsKey(name)) { Debug.LogError("unknown object pool: " + name); return(null); } Queue <GameObject> q = Objects[name]; if (q.Count == 0) { return(null); } GameObject toReturn = q.Dequeue(); IRestartable Restarter = toReturn.GetComponent <IRestartable>(); if (Restarter != null) { Restarter.Restart(); } toReturn.transform.position = transform.position; toReturn.transform.rotation = transform.rotation; toReturn.transform.localScale = transform.localScale; q.Enqueue(toReturn); return(toReturn); }
public ActionResult Restart(string playerId) { lock (_game) { return(_game.Restart(playerId)); } }
public bool RestartWithNewEncoding(Encoding newEncoding) { if (encoding.CodePage == newEncoding.CodePage) { if (restartConsumer != null) { restartConsumer.DisableRestart(); restartConsumer = null; if (restartCache != null) { restartCache.Reset(); restartCache = null; } } return(false); } if (restartConsumer == null || !restartConsumer.CanRestart()) { return(false); } restartConsumer.Restart(); SetNewEncoding(newEncoding); encodingChanged = true; if (readEnd != 0 && readFileOffset != 0) { BackupForRestart(readBuffer, 0, readEnd, readFileOffset, true); readEnd = 0; readFileOffset = 0; } readCurrent = 0; pushChunkUsed = 0; restartConsumer = null; parseStart = (parseEnd = 0); restarting = (restartCache != null && restartCache.Length != 0); return(true); }