void OnDisable() { if (m_Active) { MapObjectRendererManager.RemoveObject(this); } }
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]; } }