示例#1
0
    // Update is called once per frame
    void Update()
    {
        if (m_ParticlePrefab == null)
        {
            return;
        }

        if (m_AttachType == AttachType.Active)
        {
            if (m_bStartAttach == false)
            {
                m_fStartTime   = NcController.GetEngineTime();
                m_bStartAttach = true;
            }

            if (m_fStartTime + (m_fDelayTime / base.EffectTimeScale_) <= NcController.GetEngineTime())
            {
                CreateAttachPrefab();
                if ((0 < m_fRepeatTime && m_nRepeatCount == 0) || (m_nCreateCount < m_nRepeatCount))
                {
                    m_fStartTime = NcController.GetEngineTime();
                    m_fDelayTime = m_fRepeatTime;
                }
                else
                {
                    enabled = false;
                }
            }
        }
    }
示例#2
0
 void Init()
 {
     m_bSleep         = false;
     m_nCreateCount   = 0;
     m_fStartTime     = NcController.GetEngineTime();
     m_fEmitStartTime = 0;
 }
示例#3
0
    void LateUpdate()
    {
//      Debug.Log("NcCurveAnimation.Update " + transform.parent.name);
        if (m_fStartTime == 0)
        {
            return;
        }

        if (IsStartAnimation() == false && m_fDelayTime != 0)
        {
            if (NcController.GetEngineTime() < m_fStartTime + (m_fDelayTime / base.EffectTimeScale_))
            {
                return;
            }
//          m_fDelayTime = 0;
            InitAnimationTimer();
            if (GetComponent <Renderer>())
            {
                GetComponent <Renderer>().enabled = true;
            }
        }

        float fElapsedTime = m_Timer.GetTime() + m_fAddElapsedTime / base.EffectTimeScale_;
        float fElapsedRate = fElapsedTime;

        if (0 != m_fDurationTime)
        {
            fElapsedRate = fElapsedTime / (m_fDurationTime / base.EffectTimeScale_);
        }

        UpdateAnimation(fElapsedRate);
    }
示例#4
0
    void Update()
    {
        if (m_AudioClip == null)
        {
            enabled = false;
            return;
        }
        if (m_bEnable == false)
        {
            return;
        }

        if (m_bStartAttach == false)
        {
            m_fStartTime   = NcController.GetEngineTime();
            m_bStartAttach = true;
        }

        if (m_fStartTime + (m_nCreateCount == 0 ? (m_fDelayTime / base.EffectTimeScale_) : (m_fRepeatTime / base.EffectTimeScale_)) <= NcController.GetEngineTime())
        {
            CreateAttachSound();
            if (0 < m_fRepeatTime && (m_nRepeatCount == 0 || m_nCreateCount < m_nRepeatCount))
            {
                m_fStartTime = NcController.GetEngineTime();
            }
            else
            {
                m_bEnable = false;
            }
        }
    }
示例#5
0
    // Reset the effect to use the specified settings.
    // Except for the killCurrent option, this will only effect the
    // appearance of future spawns.
    public SpiralSettings resetEffect(bool killCurrent, SpiralSettings settings)
    {
        // If requested, destroy all current spawns of this effect.
        if (killCurrent)
        {
            killCurrentEffects();
        }

        // Assign the new settings and then spawn a new effect with these settings.
        m_nNumberOfArms         = settings.numArms;
        m_nParticlesPerArm      = settings.numPPA;
        m_fParticleSeparation   = settings.partSep;
        m_fTurnDistance         = settings.turnDist;
        m_fVerticalTurnDistance = settings.vertDist;
        m_fOriginOffset         = settings.originOffset;
        m_fTurnSpeed            = settings.turnSpeed;
        m_fFadeValue            = settings.fade;
        m_fSizeValue            = settings.size;

        SpawnEffect();
        timeOfLastSpawn = NcController.GetEngineTime();
        spawnCount++;

        return(getSettings());
    }
示例#6
0
 // Control Function -----------------------------------------------------------------
 void StartDestroy()
 {
     m_fStartDestroyTime = NcController.GetEngineTime();
     if (m_bDisableEmit)
     {
         DisableEmit();
     }
 }
示例#7
0
 void Start()
 {
     m_fStartTime = NcController.GetEngineTime();
     if (m_bEndNcCurveAnimation)
     {
         m_NcCurveAnimation = GetComponent <NcCurveAnimation>();
     }
 }
示例#8
0
 public void CopyValue(NcController controller)
 {
     this.EffectTimeScale        = controller.EffectTimeScale;
     this.m_CurrentPauseLostTime = controller.m_CurrentPauseLostTime;
     this.m_PauseLostTime        = controller.m_PauseLostTime;
     this.m_PauseTime            = controller.m_PauseTime;
     this.isPause = controller.isPause;
 }
示例#9
0
    void Update()
    {
        m_fTimeScale = Time.timeScale;

        // Recreate
        if (FXMakerMain.inst.GetInstanceEffectObject() == null && IsAutoRepeat() == false)
        {
            DelayCreateInstanceEffect(false);
        }
        else
        {
            // mesh info
            NgObject.GetMeshInfo(NcEffectBehaviour.GetRootInstanceEffect(), true, out m_nVertices, out m_nTriangles, out m_nMeshCount);

            // particle count
            m_nParticleCount = 0;
            ParticleSystem[] psComs = NcEffectBehaviour.GetRootInstanceEffect().GetComponentsInChildren <ParticleSystem>();
            foreach (ParticleSystem com in psComs)
            {
                m_nParticleCount += com.particleCount;
            }
            ParticleEmitter[] peComs = NcEffectBehaviour.GetRootInstanceEffect().GetComponentsInChildren <ParticleEmitter>();
            foreach (ParticleEmitter com in peComs)
            {
                m_nParticleCount += com.particleCount;
            }

            if (m_fDelayCreateTime < Time.time - m_fPlayStartTime)
            {
                // repeat
                if (IsRepeat() && m_fCreateTime + GetRepeatTime() < Time.time)
                {
                    DelayCreateInstanceEffect(false);
                }

                // auto repeat
                if (m_nTransIndex == 0 && IsAutoRepeat() && m_bCalledDelayCreate == false)                      // m_bStartAliveAnimation
                {
                    if (IsAliveAnimation() == false)
                    {
                        DelayCreateInstanceEffect(false);
                    }
                }

                NcController controller = GetNcController();
                if (controller != null &&
                    controller.ReachedLastFrameForEditor((int)((Time.time - m_fPlayStartTime) / NcFrameHelper.FixedSecondPerFrame)))
                {
                    m_fDelayCreateTime = 0;
                    DelayCreateInstanceEffect(false);
                }
            }
        }
    }
示例#10
0
    void ResetLocalValue()
    {
        m_size     = new Vector2(1.0f / m_nTilingX, 1.0f / m_nTilingY);
        m_Renderer = GetComponent <Renderer>();

        m_fStartTime    = NcController.GetEngineTime();
        m_nFrameCount   = (m_nFrameCount <= 0) ? m_nTilingX * m_nTilingY : m_nFrameCount;
        m_nLastIndex    = -999;
        m_nLastSeqIndex = -1;
        m_bInPartLoop   = false;
        m_bBreakLoop    = false;
    }
示例#11
0
 public override int GetAnimationState()
 {
     if ((enabled && IsActive(gameObject)))
     {
         if (NcController.GetEngineTime() < m_fStartTime + (m_fDelayTime / base.EffectTimeScale_) + 0.1f)
         {
             return(1);
         }
         return(-1);
     }
     return(-1);
 }
示例#12
0
    void Start()
    {
#if UNITY_EDITOR
        Debug.LogWarning("Waring!!! FXMaker - NcDuplicator.cs : This script is very slow. (Recommend : Not use)");
#endif
        //		Debug.Log("Duration.Start");
        if (m_bInvoke)
        {
            m_fStartTime = NcController.GetEngineTime();
            CreateCloneObject();
            InvokeRepeating("CreateCloneObject", m_fDuplicateTime, m_fDuplicateTime);
        }
    }
示例#13
0
    void Update()
    {
        if (NcController.GetEngineTime() < m_fStartTime + (m_fDelayTime / base.EffectTimeScale_))
        {
            return;
        }

        // Spin the entire particle effect.
        if (m_fTurnSpeed != 0)
        {
            this.transform.Rotate(this.transform.up * NcController.GetEngineDeltaTime() * (m_fTurnSpeed * base.EffectTimeScale_), Space.World);
        }
    }
示例#14
0
 // Control Function -----------------------------------------------------------------
 void StartDestroy()
 {
     if (m_fSmoothDestroyTime <= 0)
     {
         AutoDestruct();
     }
     else
     {
         m_fStartDestroyTime = NcController.GetEngineTime();
         if (m_bDisableEmit)
         {
             DisableEmit();
         }
     }
 }
示例#15
0
    void Start()
    {
        if (GetComponent <Renderer>() == null || GetComponent <Renderer>().sharedMaterial == null)
        {
            enabled = false;
            return;
        }

        if (0 < m_fDelayTime)
        {
            m_fStartTime = NcController.GetEngineTime();
        }
        else
        {
            InitTrailObject();
        }
    }
示例#16
0
    // Randomize the settings and return the new values.
    public SpiralSettings randomizeEffect(bool killCurrent)
    {
        // If requested, destroy all current spawns of this effect.
        if (killCurrent)
        {
            killCurrentEffects();
        }

        // Assign the new random settings and then spawn a new effect with these settings.
        RandomizeEditor();

        SpawnEffect();
        timeOfLastSpawn = NcController.GetEngineTime();
        spawnCount++;

        return(getSettings());
    }
示例#17
0
    // Loop Function --------------------------------------------------------------------
    void Start()
    {
        m_fStartTime = NcController.GetEngineTime();

        if (m_ParticlePrefab == null)
        {
            ParticleEmitter emitter = GetComponent <ParticleEmitter>();
            if (emitter == null)
            {
                return;
            }
            emitter.emit = false;
        }

        // Record the current Inspector settings as the defaults.
        defaultSettings = getSettings();
    }
示例#18
0
    void LateUpdate()
    {
        if (NcController.GetEngineTime() < m_fStartTime + (m_fDelayTime / base.EffectTimeScale_))
        {
            return;
        }

        // Check to see if it's time to spawn a new particle system.
        float timeSinceLastSpawn = NcController.GetEngineTime() - timeOfLastSpawn;

        if (m_fSpawnRate <= timeSinceLastSpawn && spawnCount < m_nNumberOfSpawns)
        {
            SpawnEffect();
            timeOfLastSpawn = NcController.GetEngineTime();
            spawnCount++;
        }
    }
示例#19
0
    void Update()
    {
//      Debug.Log("Duration.Update");
        if (m_bInvoke)
        {
            return;
        }
        // Duration
        if (m_nDuplicateCount == 0 || m_nCreateCount < m_nDuplicateCount)
        {
            if (m_fStartTime + (m_fDuplicateTime / base.EffectTimeScale_) <= NcController.GetEngineTime())
            {
                m_fStartTime = NcController.GetEngineTime();
                CreateCloneObject();
            }
        }
    }
示例#20
0
    public override void ResetAnimation()
    {
        m_NcTansform.CopyToLocalTransform(transform);

        m_fStartTime      = NcController.GetEngineTime() - m_fAddElapsedTime;
        m_Transform       = null;
        m_ChildRenderers  = null;
        m_ChildColorNames = null;

        base.ResetAnimation();
        if (0 < m_fDelayTime)
        {
            m_Timer = null;
        }
        InitAnimation();
        UpdateAnimation(0);
    }
示例#21
0
    void InitTrailObject()
    {
        m_base       = transform;
        m_fStartTime = NcController.GetEngineTime();

        m_LastPosition = transform.position;
        m_TrialObject  = new GameObject("Trail");
        m_TrialObject.transform.position   = Vector3.zero;
        m_TrialObject.transform.rotation   = Quaternion.identity;
        m_TrialObject.transform.localScale = transform.localScale;
        m_TrialObject.AddComponent(typeof(MeshFilter));
        m_TrialObject.AddComponent(typeof(MeshRenderer));
//      m_TrialObject.AddComponent<Nc>();
        m_TrialObject.GetComponent <Renderer>().sharedMaterial = GetComponent <Renderer>().sharedMaterial;
        m_TrailMesh = m_TrialObject.GetComponent <MeshFilter>().mesh;
        CreateEditorGameObject(m_TrialObject);
    }
示例#22
0
    public override void OnResetReplayStage(bool bClearOldParticle)
    {
        base.OnResetReplayStage(bClearOldParticle);
        m_fStartTime       = NcController.GetEngineTime();
        m_fStartChangeTime = 0;

        // Restore InitColor
        if (m_NcEffectInitBackup != null)
        {
            if (m_TargetType == TARGET_TYPE.MeshColor)
            {
                m_NcEffectInitBackup.RestoreMeshColor();
            }
            else
            {
                m_NcEffectInitBackup.RestoreMaterialColor();
            }
        }
    }
示例#23
0
    void OnValidate()
    {
        bool changed = false;

        if (_beforeDelayFrame != m_Sel.m_fDelayFrame)
        {
            m_Sel.m_fDelayTime = m_Sel.m_fDelayFrame * NcFrameHelper.FixedSecondPerFrame;
            _beforeDelayFrame  = m_Sel.m_fDelayFrame;
            changed            = true;
        }
        if (_beforeDelayTime != m_Sel.m_fDelayTime)
        {
            m_Sel.m_fDelayFrame = (int)(m_Sel.m_fDelayTime / NcFrameHelper.FixedSecondPerFrame);
            _beforeDelayTime    = m_Sel.m_fDelayTime;
            changed             = true;
        }
        if (_beforeDurationFrame != m_Sel.m_fDurationFrame)
        {
            m_Sel.m_fDurationTime = m_Sel.m_fDurationFrame * NcFrameHelper.FixedSecondPerFrame;
            _beforeDurationFrame  = m_Sel.m_fDurationFrame;
            changed = true;
        }
        if (_beforeDurationTime != m_Sel.m_fDurationTime)
        {
            m_Sel.m_fDurationFrame = (int)(m_Sel.m_fDurationTime / NcFrameHelper.FixedSecondPerFrame);
            _beforeDurationTime    = m_Sel.m_fDurationTime;
            changed = true;
        }
        if (changed)
        {
            NcController controller = FXMakerMain.inst.GetOriginalEffectObject().GetComponent <NcController>();
            if (controller != null)
            {
                Debug.LogFormat("controller:{0}", controller.GetInstanceID());
                Debug.LogFormat("m_sel:{0}", m_Sel.GetInstanceID());
                Debug.LogFormat("m_sel.gameObject:{0}", m_Sel.gameObject.GetInstanceID());
            }
            else
            {
                Debug.Log("controller:null");
            }
        }
    }
示例#24
0
    public override void OnResetReplayStage(bool bClearOldParticle)
    {
        base.OnResetReplayStage(bClearOldParticle);
        m_fStartTime        = NcController.GetEngineTime();
        m_fStartDestroyTime = 0;

        // Restore InitColor
        if (0 < m_fSmoothDestroyTime && m_bSmoothHide && m_NcEffectInitBackup != null)
        {
            if (m_bMeshFilterOnlySmoothHide)
            {
                m_NcEffectInitBackup.RestoreMeshColor();
            }
            else
            {
                m_NcEffectInitBackup.RestoreMaterialColor();
            }
        }
    }
示例#25
0
    void Start()
    {
//		Debug.Log("NcCurveAnimation.Start " + transform.parent.name);

        m_fStartTime = NcController.GetEngineTime() - m_fAddElapsedTime;
        InitAnimation();

        if (0 < m_fDelayTime)
        {
            if (GetComponent <Renderer>())
            {
                GetComponent <Renderer>().enabled = false;
            }
        }
        else
        {
            InitAnimationTimer();
            UpdateAnimation(0);
        }
    }
示例#26
0
    void Update()
    {
        if (0 < m_fStartChangeTime)
        {
            if (0 < m_fChangeTime)
            {
                float fElapsedRate = ((NcController.GetEngineTime() - m_fStartChangeTime) / (m_fChangeTime / base.EffectTimeScale_));
                if (1 < fElapsedRate)
                {
                    fElapsedRate = 1;
                    // m_bAutoDeactive
                    if (m_bAutoDeactive && m_fToMeshValue <= 0)
                    {
                        SetActiveRecursively(gameObject, false);
                    }
                }
                ChangeToAlpha(fElapsedRate);
            }
            else
            {
                ChangeToAlpha(1);
            }
        }
        else
        {
            // Time
//          if (0 < m_fStartTime && m_fLifeTime != 0)
            if (0 < m_fStartTime)
            {
                if (m_fStartTime + (m_fDelayTime / base.EffectTimeScale_) <= NcController.GetEngineTime())
                {
                    StartChange();
                }
            }
        }
    }
示例#27
0
    void Update()
    {
// 2016.10.07 éLÛà ¥á¥¤¥ó¥«¥á¥é¹Ì¶¨¤Ë¤Ê¤Ã¤Æ¤¦¤¿¤á¡¢‰ä¸ü¤Ç¤­¤ë¤è¤¦¤ËÐÞÕý.
#if __DRECOM_
        if (NcUtility.Camera == null)
        {
            return;
        }

        Vector3 vecUp;

        // Ä«¸Þ¶ó ¾÷º¤Å͸¦ ¹«½ÃÇÏ°í ¿ÀÁ§ÀÇ ¾÷º¤Å͸¦ À¯ÁöÇÑ´Ù
        if (m_bFixedObjectUp)
        {
//      vecUp       = m_qOiginal * Vector3.up;
            vecUp = transform.up;
        }
        else
        {
            vecUp = NcUtility.Camera.transform.rotation * Vector3.up;
        }

        if (m_bCameraLookAt)
        {
            transform.LookAt(NcUtility.Camera.transform, vecUp);
        }
        else
        {
            transform.LookAt(transform.position + NcUtility.Camera.transform.rotation * Vector3.back, vecUp);
        }
#else
        if (Camera.main == null)
        {
            return;
        }

        Vector3 vecUp;

        // Ä«¸Þ¶ó ¾÷º¤Å͸¦ ¹«½ÃÇÏ°í ¿ÀÁ§ÀÇ ¾÷º¤Å͸¦ À¯ÁöÇÑ´Ù
        if (m_bFixedObjectUp)
        {
            //              vecUp       = m_qOiginal * Vector3.up;
            vecUp = transform.up;
        }
        else
        {
            vecUp = Camera.main.transform.rotation * Vector3.up;
        }

        if (m_bCameraLookAt)
        {
            transform.LookAt(Camera.main.transform, vecUp);
        }
        else
        {
            transform.LookAt(transform.position + Camera.main.transform.rotation * Vector3.back, vecUp);
        }
#endif

        switch (m_FrontAxis)
        {
        case AXIS_TYPE.AXIS_FORWARD:    break;

        case AXIS_TYPE.AXIS_BACK:               transform.Rotate(transform.up, 180, Space.World);              break;

        case AXIS_TYPE.AXIS_RIGHT:              transform.Rotate(transform.up, 270, Space.World);              break;

        case AXIS_TYPE.AXIS_LEFT:               transform.Rotate(transform.up, 90, Space.World);              break;

        case AXIS_TYPE.AXIS_UP:                 transform.Rotate(transform.right, 90, Space.World);              break;

        case AXIS_TYPE.AXIS_DOWN:               transform.Rotate(transform.right, 270, Space.World);              break;
        }

        if (m_bFixedStand)
        {
            transform.rotation = Quaternion.Euler(new Vector3(0, transform.rotation.eulerAngles.y, transform.rotation.eulerAngles.z));
        }

        if (m_RatationMode == ROTATION.RND)
        {
            transform.localRotation *= Quaternion.Euler((m_RatationAxis == AXIS.X ? m_fRndValue : 0), (m_RatationAxis == AXIS.Y ? m_fRndValue : 0), (m_RatationAxis == AXIS.Z ? m_fRndValue : 0));
        }
        if (m_RatationMode == ROTATION.ROTATE)
        {
            float fRotValue = NcController.GetEngineDeltaTime() * m_fRotationValue;
            transform.Rotate((m_RatationAxis == AXIS.X ? fRotValue : 0), (m_RatationAxis == AXIS.Y ? fRotValue : 0), (m_RatationAxis == AXIS.Z ? fRotValue : 0), Space.Self);
//          float	fRotValue = m_fTotalRotationValue + GetEngineDeltaTime() * m_fRotationValue;
//          transform.Rotate((m_RatationAxis == AXIS.X ? fRotValue : 0), (m_RatationAxis == AXIS.Y ? fRotValue : 0), (m_RatationAxis == AXIS.Z ? fRotValue : 0), Space.Self);
//          m_fTotalRotationValue = fRotValue;
        }

//		transform.LookAt(transform.position + Camera.main.transform.rotation * Vector3.back,
//			Camera.main.transform.rotation * Vector3.up);
    }
示例#28
0
 // Property -------------------------------------------------------------------------
 // Event Function -------------------------------------------------------------------
 void OnEnable() {
     m_Sel = target as NcController;
 }
示例#29
0
    void Update()
    {
        if (m_bStartDetach == false)
        {
            m_bStartDetach = true;

            if (transform.parent != null)
            {
                m_ParentGameObject = transform.parent.gameObject;
                m_ncDetachObject   = NcDetachObject.Create(m_ParentGameObject, transform.gameObject);
            }

            // Detach Parent
            GameObject parentObj = GetRootInstanceEffect();

            if (m_bFollowParentTransform)
            {
                m_OriginalPos.SetLocalTransform(transform);
                ChangeParent(parentObj.transform, transform, false, null);
                m_OriginalPos.CopyToLocalTransform(transform);
            }
            else
            {
                ChangeParent(parentObj.transform, transform, false, null);
            }

            if (m_bParentHideToStartDestroy == false)
            {
                StartDestroy();
            }
        }

        // Live time
        if (0 < m_fStartDestroyTime)
        {
            if (0 < m_fSmoothDestroyTime)
            {
                if (m_bSmoothHide)
                {
                    float fAlphaRate = 1 - ((NcController.GetEngineTime() - m_fStartDestroyTime) / (m_fSmoothDestroyTime / base.EffectTimeScale_));
                    if (fAlphaRate < 0)
                    {
                        fAlphaRate = 0;
                    }

                    if (m_bMeshFilterOnlySmoothHide)
                    {
                        // Recursively
                        MeshFilter[] meshFilters = transform.GetComponentsInChildren <MeshFilter>(true);
                        Color        color;
                        for (int n = 0; n < meshFilters.Length; n++)
                        {
                            Color[] colors = meshFilters[n].mesh.colors;
                            if (colors.Length == 0)
                            {
                                colors = new Color[meshFilters[n].mesh.vertices.Length];
                                for (int c = 0; c < colors.Length; c++)
                                {
                                    colors[c] = Color.white;
                                }
                            }
                            for (int c = 0; c < colors.Length; c++)
                            {
                                color     = colors[c];
                                color.a   = Mathf.Min(color.a, fAlphaRate);
                                colors[c] = color;
                            }
                            meshFilters[n].mesh.colors = colors;
                        }
                    }
                    else
                    {
                        // Recursively
                        Renderer[] rens = transform.GetComponentsInChildren <Renderer>(true);
                        for (int n = 0; n < rens.Length; n++)
                        {
                            Renderer ren     = rens[n];
                            string   colName = GetMaterialColorName(ren.sharedMaterial);

                            if (colName != null)
                            {
                                Color col = ren.material.GetColor(colName);
                                col.a = Mathf.Min(col.a, fAlphaRate);
                                ren.material.SetColor(colName, col);
//                              AddRuntimeMaterial(ren.material);
                            }
                        }
                    }
                }
                if (m_fStartDestroyTime + (m_fSmoothDestroyTime / base.EffectTimeScale_) < NcController.GetEngineTime())
                {
                    Object.Destroy(gameObject);
                }
            }
        }
        else
        {
            if (m_bParentHideToStartDestroy)
            {
                if (m_ParentGameObject == null || IsActive(m_ParentGameObject) == false)
                {
                    StartDestroy();
                }
            }
        }

        // follow parent transform
        if (m_bFollowParentTransform && m_ParentGameObject != null && m_ParentGameObject.transform != null)
        {
            NcTransformTool tmp = new NcTransformTool();
            tmp.SetTransform(m_OriginalPos);
            tmp.AddTransform(m_ParentGameObject.transform);
            tmp.CopyToLocalTransform(transform);
        }
    }
示例#30
0
    void Update()
    {
        if (m_PlayMode == PLAYMODE.SELECT)
        {
            return;
        }
        if (m_Renderer == null || m_nTilingX * m_nTilingY == 0)
        {
            return;
        }

        if (m_fDelayTime != 0)
        {
            if (NcController.GetEngineTime() < m_fStartTime + (m_fDelayTime / base.EffectTimeScale_))
            {
                return;
            }
            m_fDelayTime = 0;
            InitAnimationTimer();
            m_Renderer.enabled = true;
        }

        if (m_PlayMode != PLAYMODE.RANDOM)
        {
            int nSeqIndex = (int)(m_Timer.GetTime() * m_fFps);

            if (nSeqIndex == 0)
            {
                if (m_NcSpriteFactoryCom != null)
                {
                    m_NcSpriteFactoryCom.OnAnimationStartFrame(this);
                }
//				if (m_funcStartSprite != "")
//					gameObject.SendMessage(m_funcStartSprite, this, SendMessageOptions.DontRequireReceiver);
            }

            if (m_NcSpriteFactoryCom != null && m_nFrameCount <= 0)
            {
                m_NcSpriteFactoryCom.OnAnimationLastFrame(this, 0);
            }
            else
            {
                if ((m_PlayMode == PLAYMODE.PINGPONG ? m_nFrameCount * 2 - 1 : m_nFrameCount) <= nSeqIndex)             // first loop
                {
                    if (m_bLoop == false)
                    {
                        if (m_NcSpriteFactoryCom != null)
                        {
                            if (m_NcSpriteFactoryCom.OnAnimationLastFrame(this, 1))
                            {
                                return;
                            }
                        }

                        UpdateEndAnimation();
                        return;
                    }
                    else
                    {
                        if (m_PlayMode == PLAYMODE.PINGPONG)
                        {
                            if (m_NcSpriteFactoryCom != null && nSeqIndex % (m_nFrameCount * 2 - 2) == 1)
                            {
                                if (m_NcSpriteFactoryCom.OnAnimationLastFrame(this, nSeqIndex / (m_nFrameCount * 2 - 1)))
                                {
                                    return;
                                }
                            }
                        }
                        else
                        {
                            if (m_NcSpriteFactoryCom != null && nSeqIndex % m_nFrameCount == 0)
                            {
                                if (m_NcSpriteFactoryCom.OnAnimationLastFrame(this, nSeqIndex / m_nFrameCount))
                                {
                                    return;
                                }
                            }
                        }
                    }
                }
                SetIndex(nSeqIndex);
            }
        }
    }