Example #1
0
 static string GetSampleMaterialsPath(ProceduralTree tree)
 {
     if (string.IsNullOrEmpty(pathSampleMaterials))
     {
         // Get materials folder
         pathSampleMaterials = AssetDatabase.GetAssetPath(MonoScript.FromMonoBehaviour(tree));
         pathSampleMaterials = System.IO.Path.GetDirectoryName(pathSampleMaterials) + "/SampleMaterials/";
     }
     return(pathSampleMaterials);
 }
Example #2
0
 // Use this for initialization
 void Start()
 {
     foreach (Transform child in transform.parent.transform.parent.transform)          // in [imageTarget]
     {
         if (child.tag == "Tree")
         {
             treeScript   = child.GetComponent <Wasabimole.ProceduralTree.ProceduralTree>();
             treeMaterial = child.GetComponent <Renderer>().sharedMaterial;
         }
     }
     // treeMaterial = GameObject.FindGameObjectWithTag("Tree").GetComponent<Renderer>().sharedMaterial;
 }
Example #3
0
 static void GetSampleMaterial(ProceduralTree tree)
 {
     // Get sample materials
     string[] sampleMaterials = System.IO.Directory.GetFiles(GetSampleMaterialsPath(tree), "*.mat", System.IO.SearchOption.AllDirectories);
     // Return if none found
     if (sampleMaterials.Length < 1)
     {
         return;
     }
     // Assign a random sample material
     tree.Renderer.sharedMaterial = AssetDatabase.LoadAssetAtPath(sampleMaterials[Random.Range(0, sampleMaterials.Length)], typeof(Material)) as Material;
 }
 static string GetSampleMaterialsPath(ProceduralTree tree)
 {
     if (string.IsNullOrEmpty(pathSampleMaterials))
     {
         // Get materials folder
         pathSampleMaterials = AssetDatabase.GetAssetPath(MonoScript.FromMonoBehaviour(tree));
         pathSampleMaterials = System.IO.Path.GetDirectoryName(pathSampleMaterials) + "/SampleMaterials/";
     }
     return pathSampleMaterials;
 }
 static void GetSampleMaterial(ProceduralTree tree)
 {
     // Get sample materials
     string[] sampleMaterials = System.IO.Directory.GetFiles(GetSampleMaterialsPath(tree), "*.mat", System.IO.SearchOption.AllDirectories);
     // Return if none found
     if (sampleMaterials.Length < 1) return;
     // Assign a random sample material
     tree.Renderer.sharedMaterial = AssetDatabase.LoadAssetAtPath(sampleMaterials[Random.Range(0, sampleMaterials.Length)], typeof(Material)) as Material;
 }
Example #6
0
 // Use this for initialization
 void Start()
 {
     tree = GetComponent <Wasabimole.ProceduralTree.ProceduralTree>();
     cam  = Camera.main.transform;
 }
Example #7
0
 // Use this for initialization
 void Start()
 {
     tree        = treeObject.GetComponent <Wasabimole.ProceduralTree.ProceduralTree>();
     audioSource = GetComponent <AudioSource>();
 }