Esempio n. 1
0
        private bool BuildMaterial(Wm3Texture texture, float ambient, LevelTextureType textureType, out Material material, out Sprite sprite)
        {
            bool         ret          = true;
            LevelTexture levelTexture = m_levelTextures.Find(x => x.Has(texture, ambient, textureType));

            //no material was found - create new one
            if (levelTexture == null)
            {
                ret = Construct(texture, ambient, textureType, out levelTexture);
            }

            if (ret)
            {
                material = levelTexture.Material;
                sprite   = levelTexture.Sprite;
            }
            else
            {
                material = null;
                sprite   = null;
                Debug.LogWarning("MaterialManager.BuildMaterial: unable to build Material");
            }

            return(ret);
        }
Esempio n. 2
0
        private bool Construct(Wm3Texture texture, float ambient, LevelTextureType textureType, out LevelTexture levelTexture)
        {
            bool ret = false;

            levelTexture = new LevelTexture(m_searchFolder);
            if (levelTexture.Construct(texture, ambient, textureType))
            {
                m_levelTextures.Add(levelTexture);
                AssetDatabase.CreateAsset(levelTexture.Material, m_outputFolder + "/" + levelTexture.Material.name + ".mat");
                ret = true;
            }

            return(ret);
        }