Пример #1
0
        public virtual PixelGrid GetPixelGrid()
        {
            m_PixelGridProvider ??= GetComponentInChildren <IPixelGridProvider>();

            if (m_PixelGridProvider != null)
            {
                return(m_PixelGridProvider.GetPixelGrid());
            }

            throw new MissingReferenceException("PixelGridProvider not available.");
        }
Пример #2
0
        public virtual PixelGrid GetPixelGrid()
        {
            if (m_IPixelGridProvider != null)
            {
                // Takes precedence over serialized MonoBehaviour.
                return(m_IPixelGridProvider.GetPixelGrid());
            }

            if (m_PixelGridProvider == null)
            {
                throw new MissingFieldException("Missing PixelGridProvider");
            }
            else if (!(m_PixelGridProvider is IPixelGridProvider))
            {
                throw new NotImplementedException("Serialized MonoBehaviour doesn't implement IPixelGridProvider");
            }

            return(((IPixelGridProvider)m_PixelGridProvider).GetPixelGrid());
        }