private IEnumerator DichStart() { yield return(null); lightningParticleSystem.SetActive(false); Contexts contexts = Contexts.sharedInstance; canvasRect = transform.Find("Canvas").GetComponent <RectTransform>(); Text text = transform.Find("Canvas/Empty_PowerValueRoot/Text").GetComponent <Text>(); RectTransform upperObject = transform.Find("Canvas/Empty_UpperObject").GetComponent <RectTransform>(); wppContext = Contexts.sharedInstance.wppAccrual; wppContext.DestroyAllEntities(); Slider powerScaleSlider = transform.Find("Canvas/Empty_PowerValueRoot/Slider").GetComponent <Slider>(); GameObject redScale = transform.Find("Canvas/Empty_PowerValueRoot").gameObject; GameObject greenScale = transform.Find("Canvas/Empty_FilledPowerScale").gameObject; systems = new Systems() //Движение наград .Add(new WppImagesInstantiatorSystem(contexts, canvasRect, wppIconPrefab)) .Add(new IconsDataUpdaterSystem(contexts)) .Add(new IconsUpdaterSystem(contexts, upperObject)) .Add(new WppViewDestroySystem(contexts)) .Add(new WppScaleUpdaterSystem(contexts.wppAccrual, text, redScale, greenScale, powerScaleSlider)) ; if (wppContext == null) { throw new NullReferenceException("context is null in start"); } }
private void OnDestroy() { if (systems != null) { systems.DeactivateReactiveSystems(); systems.TearDown(); wppContext.DestroyAllEntities(); systems.ClearReactiveSystems(); } }