Ejemplo n.º 1
0
        public static MaterialExistence CheckIfMaterialExists(MouldingColour.Id id)
        {
            if (File.Exists(MaterialPathUtility.GetPath(id)))
            {
                return(MaterialExistence.Current);
            }

            if (File.Exists(MaterialPathUtility.GetPath(id, true)))
            {
                return(MaterialExistence.Legacy);
            }
// FIXME Remove when colour palette experiments are over.
#if UNITY_EDITOR
            if (MouldingColour.GetBI())
            {
                if (File.Exists(MaterialPathUtility.GetPath(id, false, true)))
                {
                    return(MaterialExistence.Current);
                }

                if (File.Exists(MaterialPathUtility.GetPath(id, true, true)))
                {
                    return(MaterialExistence.Legacy);
                }
            }
#endif

            return(MaterialExistence.None);
        }
Ejemplo n.º 2
0
        private Material GetMaterial(int id)
        {
            // FIXME Remove when colour palette experiments are over.
            var useBI = MouldingColour.GetBI();
            var path  = MaterialPathUtility.GetPath((MouldingColour.Id)id, false, useBI);

            if (File.Exists(path))
            {
                return(AssetDatabase.LoadAssetAtPath <Material>(path));
            }
            else
            {
                path = MaterialPathUtility.GetPath((MouldingColour.Id)id, true, useBI);
                return(AssetDatabase.LoadAssetAtPath <Material>(path));
            }
        }
Ejemplo n.º 3
0
        public static Material LoadMaterial(MouldingColour.Id id, bool legacy)
        {
// FIXME Remove when colour palette experiments are over.
#if UNITY_EDITOR
            if (MouldingColour.GetBI())
            {
                var biMaterial = AssetDatabase.LoadAssetAtPath <Material>(MaterialPathUtility.GetPath(id, legacy, true));
                if (biMaterial)
                {
                    return(biMaterial);
                }
            }
#endif

#if UNITY_EDITOR
            return(AssetDatabase.LoadAssetAtPath <Material>(MaterialPathUtility.GetPath(id, legacy)));
#else
            return(null);
#endif
        }