protected virtual void SetId(string id, bool andEnable = false) { ID = id; if (!string.IsNullOrEmpty(id)) { string spriteName = GetSpriteResourceName(); _image.sprite = SpriteResource.GetSprite(spriteName); if (andEnable) // if we are turned off, then something else has to turn us back on. we can't make that decision. { gameObject.SetActive(true); } } else { _image.sprite = null; gameObject.SetActive(false); // our view state is now invalid, so turn off } }
private void OnDestroy() { SceneController.UnregisterTransitioner(this); Level.StopListeningForLevelEvents(ReceiveLevelEvents); SpriteResource.ClearCache(); }