private IEnumerator DissolveOutAndDestroy(DisplayableImage displayableImage, Action callback) { currentDrawingRoutine.Enqueue(true); var alpha = 1.0f; displayableImage.alpha = alpha; var startTime = Time.time; while (Time.time <= startTime + dissolveTime) { alpha -= Time.deltaTime / dissolveTime; displayableImage.alpha = alpha; yield return null; } currentDrawingRoutine.Dequeue(); Destroy(displayableImage.gameObject); if (callback != null) callback(); }
public void Hide(string displayableTag) { try { DisplayableImage targetImage = null; if (!displayableImages.ContainsKey(displayableTag)) { foreach (var image in displayableImages.Values) if (image.displayableData.name == displayableTag) { targetImage = image; break; } if (targetImage == null) throw new KeyNotFoundException(); } else { targetImage = displayableImages[displayableTag]; } displayableImages.Remove(targetImage.displayableData.tag); StartCoroutine(DissolveOutAndDestroy(targetImage, () => { //if (!isDrawing) VNController.parser.MoveNext(); })); } catch (KeyNotFoundException e) { throw new Exception("Hide Error : no displayable has tag : " + displayableTag); } catch (Exception e) { Debug.LogError(e.Message); } //VNController.parser.MoveNext(); 코루틴에서 처리했으므로 삭제 }
private IEnumerator DissolveIn(DisplayableImage displayableImage) { currentDrawingRoutine.Enqueue(true); var alpha = 0.0f; displayableImage.alpha = alpha; var startTime = Time.time; while (Time.time <= startTime + dissolveTime) { alpha += Time.deltaTime / dissolveTime; displayableImage.alpha = alpha; yield return null; } displayableImage.alpha = 1.0f; currentDrawingRoutine.Dequeue(); //if (!isDrawing) VNController.parser.MoveNext(); }