// frame 변경될 때 마다... (frame skip 되기도 함) public void OnAnimationChangingFrame(NcSpriteAnimation_B spriteCom, int nOldIndex, int nNewIndex, int nLoopCount) { // Debug.Log("OnAnimationChangingFrame() - nOldIndex = " + nOldIndex + ", nNewIndex = " + nNewIndex + ", nLoopCount = " + nLoopCount + ", m_nCurrentIndex = " + m_nCurrentIndex); if (m_SpriteList.Count <= m_nCurrentIndex) { return; } if (m_SpriteList[m_nCurrentIndex].m_EffectPrefab != null) { if ((nOldIndex < m_SpriteList[m_nCurrentIndex].m_nEffectFrame || nNewIndex <= nOldIndex) && m_SpriteList[m_nCurrentIndex].m_nEffectFrame <= nNewIndex) { if (nLoopCount == 0 || m_SpriteList[m_nCurrentIndex].m_bEffectOnlyFirst == false) { CreateEffectObject(); } } } if (m_SpriteList[m_nCurrentIndex].m_AudioClip != null) { if ((nOldIndex < m_SpriteList[m_nCurrentIndex].m_nSoundFrame || nNewIndex <= nOldIndex) && m_SpriteList[m_nCurrentIndex].m_nSoundFrame <= nNewIndex) { if (nLoopCount == 0 || m_SpriteList[m_nCurrentIndex].m_bSoundOnlyFirst == false) { CreateSoundObject(m_SpriteList[m_nCurrentIndex]); } } } }
public NcEffectBehaviour_B SetSprite(int nNodeIndex, bool bRunImmediate) { if (m_SpriteList == null || nNodeIndex < 0 || m_SpriteList.Count <= nNodeIndex) { return(null); } if (bRunImmediate) { OnChangingSprite(m_nCurrentIndex, nNodeIndex); } m_nCurrentIndex = nNodeIndex; // if (m_SpriteType == SPRITE_TYPE.NcSpriteAnimation) NcSpriteAnimation_B spriteCom = GetComponent <NcSpriteAnimation_B>(); if (spriteCom != null) { spriteCom.SetSpriteFactoryIndex(nNodeIndex, false); if (bRunImmediate) { spriteCom.ResetAnimation(); } } // if (m_SpriteType == SPRITE_TYPE.NcSpriteTexture) NcSpriteTexture_B uvCom = GetComponent <NcSpriteTexture_B>(); if (uvCom != null) { uvCom.SetSpriteFactoryIndex(nNodeIndex, -1, false); if (bRunImmediate) { // UpdateUvScale(nNodeIndex, transform); CreateEffectObject(); } } if (spriteCom != null) { return(spriteCom); } if (spriteCom != null) { return(uvCom); } return(null); }
// 마지막 frame시간 지나면..(다음 loop 첫프레임이 되면), ret가 참이면 애니변경됨 public bool OnAnimationLastFrame(NcSpriteAnimation_B spriteCom, int nLoopCount) { if (m_SpriteList.Count <= m_nCurrentIndex) { return(false); } m_bEndSprite = true; // DestroyEffectObject(); if (m_bSequenceMode) { if (m_nCurrentIndex < GetSpriteNodeCount() - 1) { if ((m_SpriteList[m_nCurrentIndex].m_bLoop ? 3 : 1) == nLoopCount) { SetSprite(m_nCurrentIndex + 1); return(true); } } else { SetSprite(0); } } else { NcSpriteAnimation_B ncTarSprite = SetSprite(m_SpriteList[m_nCurrentIndex].m_nNextSpriteIndex) as NcSpriteAnimation_B; if (ncTarSprite != null) { ncTarSprite.ResetAnimation(); return(true); } } return(false); }
// 첫 frame 시작할때... public void OnAnimationStartFrame(NcSpriteAnimation_B spriteCom) { }