// Control Function -----------------------------------------------------------------
    public void SetSpriteFactoryIndex(int nSpriteFactoryIndex, bool bRunImmediate)
    {
        if (m_NcSpriteFactoryCom == null)
        {
            if (m_NcSpriteFactoryPrefab && m_NcSpriteFactoryPrefab.GetComponent <NcSpriteFactory_B>() != null)
            {
                m_NcSpriteFactoryCom = m_NcSpriteFactoryPrefab.GetComponent <NcSpriteFactory_B>();
            }
            else
            {
                return;
            }
        }
        NcSpriteFactory_B.NcSpriteNode spriteNode = m_NcSpriteFactoryCom.GetSpriteNode(nSpriteFactoryIndex);

        m_bBuildSpriteObj     = false;
        m_bAutoDestruct       = false;
        m_fUvScale            = m_NcSpriteFactoryCom.m_fUvScale;
        m_nSpriteFactoryIndex = nSpriteFactoryIndex;
        m_nStartFrame         = 0;
        m_nFrameCount         = spriteNode.m_nFrameCount;
        m_fFps  = spriteNode.m_fFps;
        m_bLoop = spriteNode.m_bLoop;
        m_NcSpriteFrameInfos = spriteNode.m_FrameInfos;
    }
Esempio n. 2
0
//  void Update()
//  {
//  }

    // Control Function -----------------------------------------------------------------
    public void SetSpriteFactoryIndex(int nSpriteFactoryIndex, int nFrameIndex, bool bRunImmediate)
    {
        if (m_NcSpriteFactoryCom == null)
        {
            if (m_NcSpriteFactoryPrefab && m_NcSpriteFactoryPrefab.GetComponent <NcSpriteFactory_B>() != null)
            {
                m_NcSpriteFactoryCom = m_NcSpriteFactoryPrefab.GetComponent <NcSpriteFactory_B>();
            }
            else
            {
                return;
            }
        }
        m_nSpriteFactoryIndex = nSpriteFactoryIndex;
        if (m_NcSpriteFactoryCom.IsValidFactory() == false)
        {
            return;
        }
        m_NcSpriteFrameInfos = m_NcSpriteFactoryCom.GetSpriteNode(nSpriteFactoryIndex).m_FrameInfos;
        m_nFrameIndex        = (0 <= nFrameIndex ? nFrameIndex : m_nFrameIndex);
        m_nFrameIndex        = (m_NcSpriteFrameInfos.Length == 0 || m_NcSpriteFrameInfos.Length <= m_nFrameIndex ? 0 : m_nFrameIndex);
        m_fUvScale           = m_NcSpriteFactoryCom.m_fUvScale;
        if (bRunImmediate)
        {
            UpdateSpriteTexture(bRunImmediate);
        }
    }