示例#1
0
    void SimulateStart(Vector3 startPos, float fSpeed, bool bRotFront)
    {
        transform.position = startPos;
        m_fSpeed           = fSpeed;
        m_bRotFront        = bRotFront;
        m_nCircleCount     = 0;
        m_PrevPosition     = Vector3.zero;

        if (bRotFront && m_Mode == MODE_TYPE.MOVE)
        {
            transform.LookAt(m_EndPos);
        }

        // Multi shot
        if (m_Mode != MODE_TYPE.SCALE && 1 < m_nMultiShotCount)
        {
            NcDuplicator dupCom = gameObject.AddComponent <NcDuplicator>();
            dupCom.m_fDuplicateTime     = 0.2f;
            dupCom.m_nDuplicateCount    = m_nMultiShotCount;
            dupCom.m_fDuplicateLifeTime = 0;

            m_nMultiShotCreate = 0;
            m_nMultiShotIndex  = 0;
        }
        m_fStartTime = Time.time;
        Update();
    }
 private void InitCloneObject()
 {
     if (this.m_ClonObject == null)
     {
         this.m_ClonObject = base.CreateGameObject(base.gameObject);
         NcEffectBehaviour.HideNcDelayActive(this.m_ClonObject);
         NcDuplicator component = this.m_ClonObject.GetComponent <NcDuplicator>();
         if (component != null)
         {
             UnityEngine.Object.Destroy(component);
         }
         NcDelayActive component2 = this.m_ClonObject.GetComponent <NcDelayActive>();
         if (component2 != null)
         {
             UnityEngine.Object.Destroy(component2);
         }
         Component[] components = base.transform.GetComponents <Component>();
         for (int i = 0; i < components.Length; i++)
         {
             if (!(components[i] is Transform) && !(components[i] is NcDuplicator))
             {
                 UnityEngine.Object.Destroy(components[i]);
             }
         }
         NcEffectBehaviour.RemoveAllChildObject(base.gameObject, false);
         return;
     }
 }
示例#3
0
    // Control Function -----------------------------------------------------------------
    void InitCloneObject()
    {
        //      Log.info("Duration.InitCloneObject");


        if (m_ClonObject == null)
        {
            // clone ----------------
            RenderHelper.RefreshShader(gameObject);
            //       BattleManager.setTrueShaderToGameObject(gameObject, ShaderCollection.shadersLink);
            m_ClonObject      = (GameObject)CreateGameObject(gameObject);
            m_ClonObject.name = gameObject.name;
            //       BattleManager.setTrueShaderToGameObject(m_ClonObject);
            //        FxTools.setTrueShaderToGameObject(m_ClonObject);
            RenderHelper.RefreshShader(m_ClonObject);
            // Cancel ActiveControl
            HideNcDelayActive(m_ClonObject);

            // Remove Dup
            NcDuplicator durCom = m_ClonObject.GetComponent <NcDuplicator>();
            if (durCom != null)
            {
                //				DestroyImmediate(durCom);
                Destroy(durCom);
            }

            // Remove NcDelayActive
            NcDelayActive delCom = m_ClonObject.GetComponent <NcDelayActive>();
            if (delCom != null)
            {
                //				DestroyImmediate(delCom);
                Destroy(delCom);
            }

            // this ----------------
            // remove OtherComponent
            Component[] coms = transform.GetComponents <Component>();
            for (int n = 0; n < coms.Length; n++)
            {
                if ((coms[n] is Transform) == false && (coms[n] is NcDuplicator) == false)
                {
                    Destroy(coms[n]);
                }
            }

            // removeChild
#if (UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9)
            RemoveAllChildObject(gameObject, false);
#else
            //			RemoveAllChildObject(gameObject, true);		OnTrigger error - DestroyImmediate
            RemoveAllChildObject(gameObject, false);
#endif
        }
        else
        {
            return;
        }
    }
示例#4
0
    // Control Function -----------------------------------------------------------------
    void InitCloneObject()
    {
//      Debug.Log("Duration.InitCloneObject");

        if (m_ClonObject == null)
        {
            // clone ----------------
            m_ClonObject = (GameObject)CreateGameObject(gameObject);

            // Cancel ActiveControl
            HideNcDelayActive(m_ClonObject);
            try
            {
                // Remove Dup
                NcDuplicator durCom = m_ClonObject.GetComponent <NcDuplicator>();
                if (durCom != null)
                {
                    //				DestroyImmediate(durCom);
                    Destroy(durCom);
                }

                // Remove NcDelayActive
                NcDelayActive delCom = m_ClonObject.GetComponent <NcDelayActive>();
                if (delCom != null)
                {
                    //				DestroyImmediate(delCom);
                    Destroy(delCom);
                }

                // this ----------------
                // remove OtherComponent
                Component[] coms = transform.GetComponents <Component>();
                for (int n = 0; n < coms.Length; n++)
                {
                    if ((coms[n] is Transform) == false && (coms[n] is NcDuplicator) == false)
                    {
                        Destroy(coms[n]);
                    }
                }

                // removeChild
            }
            catch (NullReferenceException)
            {
            }

#if (!UNITY_3_5)
            RemoveAllChildObject(gameObject, false);
#else
            //			RemoveAllChildObject(gameObject, true);		OnTrigger error - DestroyImmediate
            RemoveAllChildObject(gameObject, false);
#endif
        }
        else
        {
            return;
        }
    }
示例#5
0
    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();
    }
    // Control Function -----------------------------------------------------------------
    void InitCloneObject()
    {
        if (m_ClonObject == null)
        {
            // clone ----------------
            m_ClonObject = (GameObject)CreateGameObject(gameObject);

            // Cancel ActiveControl
            HideNcDelayActive(m_ClonObject);

            // Remove Dup
            NcDuplicator durCom = m_ClonObject.GetComponent <NcDuplicator>();
            if (durCom != null)
            {
//				DestroyImmediate(durCom);
                Destroy(durCom);
            }

            // Remove NcDelayActive
            NcDelayActive delCom = m_ClonObject.GetComponent <NcDelayActive>();
            if (delCom != null)
            {
//				DestroyImmediate(delCom);
                Destroy(delCom);
            }

            // this ----------------
            // remove OtherComponent
            Component[] coms = transform.GetComponents <Component>();
            for (int n = 0; n < coms.Length; n++)
            {
                if ((coms[n] is Transform) == false && (coms[n] is NcDuplicator) == false)
                {
                    Destroy(coms[n]);
                }
            }

            // removeChild
#if (UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9)
            RemoveAllChildObject(gameObject, false);
#else
//			RemoveAllChildObject(gameObject, true);		OnTrigger error - DestroyImmediate
            RemoveAllChildObject(gameObject, false);
#endif
        }
        else
        {
            return;
        }
    }
示例#7
0
    //
    //       [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();
    }
    //	[HideInInspector]

    // static init ------------------------------------------------------------------------
    public static void CreateInstanceIndexing(Transform oriTrans, Transform insTrans, bool bSameValueRecursively, bool bRuntimeCreatedObj)
    {
        if (insTrans == null)
        {
            return;
        }

        FxmInfoIndexing com = insTrans.gameObject.AddComponent <FxmInfoIndexing>();

        com.SetOriginal(oriTrans, bRuntimeCreatedObj);
        com.OnAutoInitValue();

        // Dup process
        NcDuplicator dupCom = com.GetComponent <NcDuplicator>();

        if (dupCom != null)
        {
            GameObject clone = dupCom.GetCloneObject();
            if (clone != null)
            {
                CreateInstanceIndexing(oriTrans, clone.transform, bSameValueRecursively, false);
            }
        }

        if (bSameValueRecursively)
        {
            for (int n = 0; n < insTrans.GetChildCount(); n++)
            {
                CreateInstanceIndexing(oriTrans, insTrans.GetChild(n), bSameValueRecursively, true);
            }
        }
        else
        {
            for (int n = 0; n < oriTrans.GetChildCount(); n++)
            {
                if (n < insTrans.GetChildCount())
                {
                    CreateInstanceIndexing(oriTrans.GetChild(n), insTrans.GetChild(n), bSameValueRecursively, bRuntimeCreatedObj);
                }
            }
        }
    }
示例#9
0
    protected void Init()
    {
        // 如果是源
        if (_isOrigin)
        {
            GameObject go = CreateGameObject(transform.parent.gameObject, gameObject);
            go.name = gameObject.name;
            //   StarEngine.Debuger.LogTrace(name + " alpha:" + renderer.material.color.a);
            //FxTools.setTrueShaderToGameObject(go);
            if (_eod != null)
            {
                _eod.cloneObjectList.Add(go);
            }
            NcDuplicator nd = go.GetComponent <NcDuplicator>();
            nd._isOrigin = false;
            nd.effectObjectDescriptor = effectObjectDescriptor;
            gameObject.SetActive(false);
            return;
        }

        m_nCreateCount = 0;
        m_fStartTime   = -m_fDuplicateTime;
        m_ClonObject   = null;
        m_bInvoke      = false;

        if (enabled == false)
        {
            return;
        }

        //      Log.info("Duration.Awake");
#if UNITY_EDITOR
        if (IsCreatingEditObject() == false)
#endif
        if (transform.parent != null && (enabled && IsActive(gameObject) && GetComponent <NcDontActive>() == null))
        {
            InitCloneObject();
        }
    }
示例#10
0
    void InitCloneObject()
    {
        //      Debug.Log("Duration.InitCloneObject");
        if (m_ClonObject == null)
        {
            m_ClonObject = CreateGameObject(gameObject);
            HideNcDelayActive(m_ClonObject);
            NcDuplicator durCom = m_ClonObject.GetComponent <NcDuplicator>();
            if (durCom != null)
            {
                //				DestroyImmediate(durCom);
                Destroy(durCom);
            }
            NcDelayActive delCom = m_ClonObject.GetComponent <NcDelayActive>();
            if (delCom != null)
            {
                //				DestroyImmediate(delCom);
                Destroy(delCom);
            }
            Component[] coms = transform.GetComponents <Component>();
            for (int n = 0; n < coms.Length; n++)
            {
                if (!(coms[n] is Transform) && !(coms[n] is NcDuplicator))
                {
                    Destroy(coms[n]);
                }
            }
#if (!UNITY_3_5)
            RemoveAllChildObject(gameObject, false);
#else
//			RemoveAllChildObject(gameObject, true);		OnTrigger error - DestroyImmediate
            RemoveAllChildObject(gameObject, false);
#endif
        }
        else
        {
            return;
        }
    }
示例#11
0
    private void Awake()
    {
        this.init = true;
        NcDuplicator componentInChildren = base.gameObject.GetComponentInChildren <NcDuplicator>();

        if (componentInChildren != null)
        {
            LogSystem.LogWarning(new object[]
            {
                base.gameObject.name,
                " NcDuplicator cannot be replayed."
            });
            return;
        }
        this.list1 = base.gameObject.GetComponentsInChildren <NcSpriteAnimation>(true);
        this.list2 = base.gameObject.GetComponentsInChildren <NcCurveAnimation>(true);
        this.list3 = base.gameObject.GetComponentsInChildren <NcDelayActive>(true);
        this.list4 = base.gameObject.GetComponentsInChildren <NcUvAnimation>(true);
        this.list5 = base.gameObject.GetComponentsInChildren <ParticleSystem>(true);
        this.list6 = base.gameObject.GetComponentsInChildren <Animation>(true);
        this.list8 = base.gameObject.GetComponentsInChildren <DestroyForTime>(true);
    }
示例#12
0
 private void SimulateStart(Vector3 startPos, float fSpeed, bool bRotFront)
 {
     base.transform.position = startPos;
     this.m_fSpeed           = fSpeed;
     this.m_bRotFront        = bRotFront;
     this.m_nCircleCount     = 0;
     this.m_PrevPosition     = Vector3.zero;
     if (bRotFront && this.m_Mode == FxmTestSimulate.MODE_TYPE.MOVE)
     {
         base.transform.LookAt(this.m_EndPos);
     }
     if (this.m_Mode != FxmTestSimulate.MODE_TYPE.SCALE && 1 < this.m_nMultiShotCount)
     {
         NcDuplicator ncDuplicator = base.gameObject.AddComponent <NcDuplicator>();
         ncDuplicator.m_fDuplicateTime      = 0.2f;
         ncDuplicator.m_nDuplicateCount     = this.m_nMultiShotCount;
         ncDuplicator.m_fDuplicateLifeTime  = 0f;
         FxmTestSimulate.m_nMultiShotCreate = 0;
         this.m_nMultiShotIndex             = 0;
     }
     this.m_fStartTime = Time.time;
     this.Update();
 }
示例#13
0
 // Property -------------------------------------------------------------------------
 // Event Function -------------------------------------------------------------------
 void OnEnable()
 {
     m_Sel         = target as NcDuplicator;
     m_UndoManager = new FXMakerUndoManager(m_Sel, "NcDuplicator");
 }
	// Property -------------------------------------------------------------------------
	// Event Function -------------------------------------------------------------------
    void OnEnable()
    {
 		m_Sel = target as NcDuplicator;
 		m_UndoManager	= new FXMakerUndoManager(m_Sel, "NcDuplicator");
   }
示例#15
0
    //镜面翻转.....
    //         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();
    }
示例#16
0
 public static void ResetEffect(GameObject oEffect)
 {
     if (oEffect == null)
     {
         return;
     }
     if (oEffect.layer == SpawnPool.miEffectLayer || oEffect.layer == SpawnPool.miUIEffectLayer || oEffect.layer == SpawnPool.miModelLayer)
     {
         NcDuplicator componentInChildren = oEffect.GetComponentInChildren <NcDuplicator>();
         if (componentInChildren != null)
         {
             LogSystem.LogWarning(new object[]
             {
                 oEffect.name,
                 " NcDuplicator cannot be replayed."
             });
             return;
         }
         NcSpriteAnimation[] componentsInChildren = oEffect.GetComponentsInChildren <NcSpriteAnimation>(true);
         for (int i = 0; i < componentsInChildren.Length; i++)
         {
             if (componentsInChildren[i] != null)
             {
                 componentsInChildren[i].ResetAnimation();
             }
         }
         NcCurveAnimation[] componentsInChildren2 = oEffect.GetComponentsInChildren <NcCurveAnimation>(true);
         for (int j = 0; j < componentsInChildren2.Length; j++)
         {
             if (componentsInChildren2[j] != null)
             {
                 componentsInChildren2[j].ResetAnimation();
             }
         }
         NcDelayActive[] componentsInChildren3 = oEffect.GetComponentsInChildren <NcDelayActive>(true);
         for (int k = 0; k < componentsInChildren3.Length; k++)
         {
             if (componentsInChildren3[k] != null)
             {
                 componentsInChildren3[k].ResetAnimation();
             }
         }
         NcUvAnimation[] componentsInChildren4 = oEffect.GetComponentsInChildren <NcUvAnimation>(true);
         for (int l = 0; l < componentsInChildren4.Length; l++)
         {
             if (componentsInChildren4[l] != null)
             {
                 componentsInChildren4[l].ResetAnimation();
             }
         }
         ParticleSystem[] componentsInChildren5 = oEffect.GetComponentsInChildren <ParticleSystem>(true);
         for (int m = 0; m < componentsInChildren5.Length; m++)
         {
             ParticleSystem particleSystem = componentsInChildren5[m];
             if (particleSystem != null)
             {
                 particleSystem.Stop();
                 particleSystem.Clear();
                 particleSystem.time = 0f;
                 particleSystem.Play();
             }
         }
         Animation[] componentsInChildren6 = oEffect.GetComponentsInChildren <Animation>(true);
         for (int n = 0; n < componentsInChildren6.Length; n++)
         {
             Animation animation = componentsInChildren6[n];
             if (!(animation == null))
             {
                 foreach (AnimationState animationState in animation)
                 {
                     animationState.time = 0f;
                 }
                 animation.Play();
             }
         }
         DestroyForTime[] componentsInChildren7 = oEffect.GetComponentsInChildren <DestroyForTime>(true);
         for (int num = 0; num < componentsInChildren7.Length; num++)
         {
             DestroyForTime destroyForTime = componentsInChildren7[num];
             if (!(destroyForTime == null))
             {
                 destroyForTime.Reset();
             }
         }
     }
 }