예제 #1
0
 public void CoalAtIndex(int index)
 {
     if (getBiomeAtIndex(index) == HIGH_BIOME)
     {
         if (vertices [index].getResource() != null && vertices [index].getResource().name.Contains("Coal"))
         {
             return;
         }
         ResourceController resourceCont = (GameObject.FindObjectOfType(typeof(ResourceController)) as ResourceController);
         if (resourceCont != null)
         {
             resourceCont.CoalMade(vertices [index]);
         }
         (GameObject.FindObjectOfType(typeof(MusicController)) as MusicController).StartPlacing();
         GameObject coal = Resources.Load("Prefabs/CoalVein" + Random.Range(0, 1), typeof(GameObject)) as GameObject;
         coal = Instantiate(coal, transform.TransformPoint(vertices[index].getSphereVector()), Quaternion.identity) as GameObject;
         vertices [index].removeResource();
         vertices [index].setResource(coal);
     }
 }
예제 #2
0
    public void FireBuilt()
    {
        curTier++;
        GameObject g = GameObject.Find("TierNum");

        if (g != null)
        {
            Text t = g.GetComponent <Text> ();
            if (t != null)
            {
                t.text = curTier.ToString();
            }
        }
        g = GameObject.Find("TierName");
        if (g != null)
        {
            g.GetComponent <ToggleEraText> ().ChangeEraText(curTier);
        }
        ResourceController cont    = GetComponent <ResourceController>();
        SphereTerrain      terrain = FindObjectOfType <SphereTerrain> ();

        for (int i = 0; i < terrain.vertices.Length; i++)
        {
            Vertex v = terrain.vertices[i];

            if (v.getBiome() == SphereTerrain.WATER_BIOME)
            {
                cont.WaterMade(v);
            }
            if (v.getBiome() == SphereTerrain.STONE_BIOME)
            {
                cont.StoneMade(v);
            }
            if (v.getBiome() == SphereTerrain.OIL_BIOME)
            {
                cont.OilMade(v);
            }
            if (v.getResource() != null)
            {
                if (v.getResource().name.Contains("Forest"))
                {
                    cont.TreeMade(v);
                }
                if (v.getResource().name.Contains("Sand"))
                {
                    cont.SandMade(v);
                }
                if (v.getResource().name.Contains("Wheat"))
                {
                    cont.WheatMade(v);
                }
                if (v.getResource().name.Contains("Iron"))
                {
                    cont.IronMade(v);
                }
                if (v.getResource().name.Contains("Copper"))
                {
                    cont.CopperMade(v);
                }
                if (v.getResource().name.Contains("Coal"))
                {
                    cont.CoalMade(v);
                }
            }
        }
    }
예제 #3
0
    public void IncreaseTier()
    {
        if (CheckTier())
        {
            ConstructEra();
            curTier++;
            GameObject g = GameObject.Find("TierNum");
            if (g != null)
            {
                Text t = g.GetComponent <Text> ();
                if (t != null)
                {
                    t.text = curTier.ToString();
                }
            }
            g = GameObject.Find("TierName");
            if (g != null)
            {
                g.GetComponent <ToggleEraText> ().ChangeEraText(curTier);
                g.GetComponent <ToggleEraText> ().firstTimeInTier = true;
            }
            ResourceController cont    = GetComponent <ResourceController>();
            SphereTerrain      terrain = FindObjectOfType <SphereTerrain> ();
            for (int i = 0; i < terrain.vertices.Length; i++)
            {
                Vertex v = terrain.vertices[i];

                if (v.getBiome() == SphereTerrain.WATER_BIOME)
                {
                    cont.WaterMade(v);
                }
                if (v.getBiome() == SphereTerrain.STONE_BIOME)
                {
                    cont.StoneMade(v);
                }
                if (v.getBiome() == SphereTerrain.OIL_BIOME)
                {
                    cont.OilMade(v);
                }
                if (v.getResource() != null)
                {
                    if (v.getResource().name.Contains("Forest"))
                    {
                        cont.TreeMade(v);
                    }
                    if (v.getResource().name.Contains("Sand"))
                    {
                        cont.SandMade(v);
                    }
                    if (v.getResource().name.Contains("Wheat"))
                    {
                        cont.WheatMade(v);
                    }
                    if (v.getResource().name.Contains("Iron"))
                    {
                        cont.IronMade(v);
                    }
                    if (v.getResource().name.Contains("Copper"))
                    {
                        cont.CopperMade(v);
                    }
                    if (v.getResource().name.Contains("Coal"))
                    {
                        cont.CoalMade(v);
                    }
                }
            }
            //TODO: check if we want all resources present in the spheremap
            tierIncreaseEvent.Invoke();
        }
    }