Beispiel #1
0
    void Match()
    {
        GameObject holder = GameObject.Find("Holder");

        if (holder)
        {
            string str = myType.ToString();
            if (str == "Tree")
            {
                this.gameObject.GetComponent <MeshRenderer> ().material = holder.GetComponent <HolderTest> ().Tree;
            }
            else if (str == "UnderBrush")
            {
                this.gameObject.GetComponent <MeshRenderer> ().material = holder.GetComponent <HolderTest> ().Brush;
            }
            else if (str == "Lava")
            {
                this.gameObject.GetComponent <MeshRenderer> ().material = holder.GetComponent <HolderTest> ().Lava;
            }
            else
            {
                this.gameObject.GetComponent <MeshRenderer> ().material = holder.GetComponent <HolderTest> ().Grass;
            }
        }
        transform.localPosition = new Vector3(pos.x, height / 2f, pos.y);
        transform.localScale    = new Vector3(1, height, 1);
    }
Beispiel #2
0
 public void SetTexture(TerrainTypes terrain)
 {
     GetComponent <Renderer>().material.mainTexture = Resources.Load <Texture>("Textures/" + terrain.ToString());
 }
 public static Texture GetTexture(TerrainTypes type)
 {
     return(GetTexture("terrain_" + type.ToString()));
 }
Beispiel #4
0
 private static string GetTerrainImageKey(TerrainTypes terrainType, PlotTypes plotType, FeatureTypes featureType)
 {
     if (plotType == PlotTypes.PEAK)
         return "PEAK";
     else if (featureType == FeatureTypes.FEATURE_ICE)
         return "ICE";
     else if (featureType == FeatureTypes.FEATURE_OASIS)
         return "OASIS";
     string key = "";
     if (featureType == FeatureTypes.FEATURE_JUNGLE)
         key = "JUNGLE";
     else
         key = terrainType.ToString().Replace("TERRAIN_", "");
     if ((terrainType == TerrainTypes.TERRAIN_GRASS || terrainType == TerrainTypes.TERRAIN_PLAINS || terrainType == TerrainTypes.TERRAIN_TUNDRA) && featureType == FeatureTypes.FEATURE_FOREST)
         key += "_FOREST";
     if ((terrainType == TerrainTypes.TERRAIN_GRASS || terrainType == TerrainTypes.TERRAIN_PLAINS || terrainType == TerrainTypes.TERRAIN_TUNDRA || terrainType == TerrainTypes.TERRAIN_SNOW || terrainType == TerrainTypes.TERRAIN_DESERT) && plotType == PlotTypes.HILL)
         key += "_HILL";
     return key;
 }
 public static Texture GetTexture(TerrainTypes type)
 {
     return GetTexture("terrain_"+type.ToString());
 }