コード例 #1
0
		Texture GetVoxelPaint(string textureName, Texture prevTexture){
			if (textureName == "null")
				return null;

			if(textureName == "")
				return prevTexture;

			if (textureName.EndsWith ("_s")) {
				textureName = textureName.Substring (0, textureName.Length - 2);
				textureName += "_c";
			}

			terrainManager = FindObjectOfType<AGF_TerrainManager> ();

			foreach (KeyValuePair<string,Texture2D> texture in terrainManager.GetLoadedColormaps ()) {
				if(texture.Value.name == textureName){
					return texture.Value;
				}
			}
			foreach (KeyValuePair<string,Texture2D> texture in terrainManager.GetLoadedNormalmaps()) {
				if(texture.Value.name == textureName){
					return texture.Value;
				}
			}
			foreach (Texture2D tex in terrainManager.defaultTextures) {
				if (tex.name == textureName) {
					return tex;
				}
			}

			Debug.LogError ("Could not find terrain " + textureName + " in loaded asset bundles");
			return prevTexture;
		}
コード例 #2
0
		Texture GetVoxelGrass(string textureName, Texture prevTexture){
			if (!terrainManager)
				terrainManager = FindObjectOfType<AGF_TerrainManager> ();


			foreach (KeyValuePair<string,Texture2D> texture in terrainManager.GetLoadedVegetationTextures ()) {
				if(texture.Value.name == textureName){
					return texture.Value;
				}
			}

			return prevTexture;
		}
コード例 #3
0
 void Start()
 {
     m_AssetLoader = FindObjectOfType<AGF_AssetLoader> ();
     m_TerrainManager = FindObjectOfType<AGF_TerrainManager> ();
 }
コード例 #4
0
    Texture GetVoxelPaint(string textureName, Texture prevTexture)
    {
        if(textureName == "")
            return prevTexture;

        m_AssetLoader = FindObjectOfType<AGF_AssetLoader> ();
        m_TerrainManager = FindObjectOfType<AGF_TerrainManager> ();

        foreach (Texture2D texture in m_AssetLoader.GetCustomPaint()) {
            if(texture.name == textureName){

                Texture2D newTexture = new Texture2D(texture.width, texture.height,TextureFormat.ARGB32,false);
                newTexture.SetPixels(texture.GetPixels());
                newTexture.name = textureName;
                newTexture.Apply();

                return newTexture;
            }
        }
        foreach (Texture2D texture in m_AssetLoader.GetCustomPaintNormals()) {
            if(texture.name == textureName){

                Texture2D newTexture = new Texture2D(texture.width, texture.height,TextureFormat.ARGB32,false);
                newTexture.SetPixels(texture.GetPixels());
                newTexture.name = textureName;
                newTexture.Apply();

                return newTexture;
            }
        }

        foreach (KeyValuePair<string,Texture2D> texture in m_TerrainManager.GetLoadedColormaps ()) {
            if(texture.Value.name == textureName){

                Texture2D newTexture = new Texture2D(texture.Value.width, texture.Value.height,TextureFormat.ARGB32,false);
                newTexture.SetPixels(texture.Value.GetPixels());
                newTexture.name = textureName;
                newTexture.Apply();

                return newTexture;
            }
        }
        foreach (KeyValuePair<string,Texture2D> texture in m_TerrainManager.GetLoadedNormalmaps()) {
            if(texture.Value.name == textureName){

                Texture2D newTexture = new Texture2D(texture.Value.width, texture.Value.height,TextureFormat.ARGB32,false);
                newTexture.SetPixels(texture.Value.GetPixels());
                newTexture.name = textureName;
                newTexture.Apply();

                return newTexture;
            }
        }

        return prevTexture;
    }
コード例 #5
0
    public void SetVoxelGrass(string textureName, string bundleName, int grassSlot)
    {
        if(textureName == "")
            return;

        if(!m_TerrainManager)
            m_TerrainManager = FindObjectOfType<AGF_TerrainManager>();
        if(!m_AssetLoader)
            m_AssetLoader = FindObjectOfType<AGF_AssetLoader>();

        if (bundleName == "") {
            foreach (Texture2D texture in m_AssetLoader.GetCustomVegetations()) {
                if (texture.name == textureName) {
                    voxelTerrain[selectedTerrain].types[grassSlot].grassMaterial.mainTexture = texture;
                    voxelTerrain[selectedTerrain].types[grassSlot].grassBundle = "";
                }
            }
        } else {
            foreach (KeyValuePair<string,Texture2D> texture in m_TerrainManager.GetLoadedVegetationTextures ()) {
                if (texture.Value.name == textureName && texture.Key == bundleName) {
                    voxelTerrain[selectedTerrain].types[grassSlot].grassMaterial.mainTexture = texture.Value;
                    voxelTerrain[selectedTerrain].types[grassSlot].grassBundle = texture.Key;
                }
            }
        }
    }
コード例 #6
0
 public SkyboxProperties()
     : base()
 {
     // store references
     m_TerrainManager = GameObject.Find ("AGF_TerrainManager").GetComponent<AGF_TerrainManager>();
     m_SaveDataManager = GameObject.Find ("AGF_LevelLoader").GetComponent<AGF_LevelLoader>();
     m_CameraManager = GameObject.Find ("AGF_CameraManager").GetComponent<AGF_CameraManager>();
 }
コード例 #7
0
 public KeyLightProperties( Transform newTransform )
     : base(newTransform)
 {
     m_TerrainManager = GameObject.Find ("AGF_TerrainManager").GetComponent<AGF_TerrainManager>();
     m_CameraManager = GameObject.Find("AGF_CameraManager").GetComponent<AGF_CameraManager>();
 }
コード例 #8
0
		void Start(){
			terrainManager = FindObjectOfType<AGF_TerrainManager> ();
		}