Exemplo n.º 1
0
 void OnDisable()
 {
     if (m_Active)
     {
         MapObjectRendererManager.RemoveObject(this);
     }
 }
Exemplo n.º 2
0
    public void SetSprites(Sprite[] a_Sprites)
    {
        if (a_Sprites == null ||
            a_Sprites.Length < 2)
        {
            if (m_Active)
            {
                MapObjectRendererManager.RemoveObject(this);
            }

            m_Active = false;
        }
        else
        {
            if (!m_Active)
            {
                MapObjectRendererManager.AddObject(this);
            }

            m_Active = true;
        }

        m_Sprites = a_Sprites;

        if (!m_Active)
        {
            if (m_Sprites != null &&
                m_Sprites.Length > 0)
            {
                m_SpriteRenderer.sprite = m_Sprites[0];
            }
            else
            {
                m_SpriteRenderer.sprite = null;
            }
        }
        else
        {
            m_SpriteRenderer.sprite = m_Sprites[(MapObjectRendererManager.CurrentFrame + m_Offset) % m_Sprites.Length];
        }
    }