コード例 #1
0
ファイル: TextureManager.cs プロジェクト: firoball/Wm3Util
        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);
        }
コード例 #2
0
ファイル: TextureManager.cs プロジェクト: firoball/Wm3Util
        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);
        }