public void reStart() { // Profiler.BeginSample("effect restart"); if (_gameObject == null) { return; } _gameObject.SetActive(true); for (int i = 0; i < delayList.Count; i++) { Delay delay = delayList[i]; delay.Reset(); } for (int i = 0; i < particleSystemList.Count; i++) { ParticleSystem ps = particleSystemList[i]; //ps.time = 0; ps.playbackSpeed = 1; ps.Simulate(0, false, true); ps.Play(); } for (int i = 0; i < ncEffectAniBehaviourList.Count; i++) { NcEffectAniBehaviour ncEAB = ncEffectAniBehaviourList[i]; if (ncEAB == null) { continue; } ncEAB.ResetAnimation(); } for (int i = 0; i < animatorList.Count; i++) { Animator animator = animatorList[i]; animator.speed = 1; } for (int i = 0; i < animationList.Count; i++) { Animation animation = animationList[i]; animation.Play(); } for (int i = 0; i < ncDuplicatorList.Count; i++) { NcDuplicator ncDuplicator = ncDuplicatorList[i]; ncDuplicator.ReStart(); } for (int i = 0; i < ncTrailTextureList.Count; i++) { NcTrailTexture ncT = ncTrailTextureList[i]; ncT.reset(); } // Profiler.EndSample(); }
// // [ContextMenu("RecordState")] public void RecordState() { // Profiler.BeginSample("effect desc"); if (_hasInit) { // Profiler.EndSample(); return; } _hasInit = true; for (int i = 0; i < ncEffectAniBehaviourList.Count; i++) { NcEffectAniBehaviour ncEAB = ncEffectAniBehaviourList[i]; ncEAB.isReuse = true; ncEAB.RecordStartState(); } for (int i = 0; i < ncDuplicatorList.Count; i++) { NcDuplicator ncd = ncDuplicatorList[i]; ncd.effectObjectDescriptor = this; ncd.isReuse = true; ncd.RecordStartState(); } for (int i = 0; i < ncRotationList.Count; i++) { NcRotation ncR = ncRotationList[i]; ncR.isReuse = true; ncR.RecordStartState(); } for (int i = 0; i < ncRotationList.Count; i++) { NcRotation ncR = ncRotationList[i]; ncR.isReuse = true; ncR.RecordStartState(); } for (int i = 0; i < ncTrailTextureList.Count; i++) { NcTrailTexture ncT = ncTrailTextureList[i]; ncT.isReuse = true; ncT.RecordStartState(); } // Profiler.EndSample(); }
// Property ------------------------------------------------------------------------- // Event Function ------------------------------------------------------------------- void OnEnable() { m_Sel = target as NcTrailTexture; m_UndoManager = new FXMakerUndoManager(m_Sel, "NcTrailTexture"); }
//镜面翻转..... // public void setMirrorObject(bool bMirror=false) { // for (int i = 0; i < particleSystemList.Count; i++) // { // ParticleSystem ps = particleSystemList[i]; // if (ps.GetComponent<MirrorEffect>() != null) // { // if (bMirror) // { // Vector3 scale = ps.transform.localScale; // scale.x = -Mathf.Abs(ps.transform.localScale.x); // ps.transform.localScale = scale; // } // else // { // Vector3 scale = ps.transform.localScale; // scale.x = Mathf.Abs(ps.transform.localScale.x); // ps.transform.localScale = scale; // } // } // } // } public void setDisable() { // Profiler.BeginSample("effect disable"); // if (ncDuplicator.Count > 0) // { // particleSystemList = _gameObject.GetComponentsInChildren<ParticleSystem>(true).ToList(); // animationList = _gameObject.GetComponentsInChildren<Animation>(true).ToList(); // //spriteAnimationList = _gameObject.GetComponentsInChildren<SpriteAnimation>(true); // ncCurveAnimationList = _gameObject.GetComponentsInChildren<NcCurveAnimation>(true).ToList(); // ncSpriteAnimationList = _gameObject.GetComponentsInChildren<NcSpriteAnimation>(true).ToList(); // ncUvAnimationList = _gameObject.GetComponentsInChildren<NcUvAnimation>(true).ToList(); // particleSystemRendererList = _gameObject.GetComponentsInChildren<ParticleSystemRenderer>(true).ToList(); // skinnedMeshRendererList = _gameObject.GetComponentsInChildren<SkinnedMeshRenderer>(true).ToList(); // meshRendererList = _gameObject.GetComponentsInChildren<MeshRenderer>(true).ToList(); // ncEffectAniBehaviourList = _gameObject.GetComponentsInChildren<NcEffectAniBehaviour>(true).ToList(); // delayList = _gameObject.GetComponentsInChildren<Delay>(true).ToList(); // } // for (int i = 0; i < particleSystemList.Count; i++) // { // ParticleSystem ps = particleSystemList[i]; // //ps.Stop(); // } if ((_gameObject == null) || (animatorList == null) || (((animatorList.Count > 0) && (animatorList[0] == null)))) { return; } for (int i = 0; i < animatorList.Count; i++) { Animator animator = animatorList[i]; animator.speed = 0; } for (int i = 0; i < animationList.Count; i++) { Animation animation = animationList[i]; animation.Stop(); } for (int i = 0; i < ncEffectAniBehaviourList.Count; i++) { NcEffectAniBehaviour ncEAB = ncEffectAniBehaviourList[i]; if (ncEAB == null) { ncEffectAniBehaviourList.RemoveAt(i); i--; continue; } ncEAB.PauseAnimation(); ncEAB.ResetToStartState(); } for (int i = 0; i < ncDuplicatorList.Count; i++) { NcDuplicator ncd = ncDuplicatorList[i]; ncd.ResetToStartState(); } for (int i = 0; i < ncRotationList.Count; i++) { NcRotation ncR = ncRotationList[i]; ncR.ResetToStartState(); } for (int i = 0; i < ncTrailTextureList.Count; i++) { NcTrailTexture ncT = ncTrailTextureList[i]; ncT.ResetToStartState(); } for (int i = 0; i < cloneObjectList.Count; i++) { GameObject.DestroyImmediate(cloneObjectList[i]); } cloneObjectList.Clear(); _gameObject.transform.localPosition = position; _gameObject.transform.localScale = scale; _gameObject.transform.localRotation = rotation; //resetTransform(); _gameObject.SetActive(false); // Profiler.EndSample(); }