예제 #1
0
        /// <summary>
        /// Get the significant details of what needs approval
        /// </summary>
        /// <returns>A list of strings</returns>
        public override IDictionary <string, string> SignificantDetails()
        {
            IDictionary <string, string> returnList = base.SignificantDetails();

            returnList.Add("Temperature", TemperatureCoefficient.ToString());
            returnList.Add("Pressure", PressureCoefficient.ToString());
            returnList.Add("Biome", BaseBiome.ToString());
            returnList.Add("Hemisphere", Hemisphere.ToString());

            return(returnList);
        }
예제 #2
0
    public static BaseBiome GenerateBiome()
    {
        GameObject biomeObject = (GameObject)Instantiate(Resources.Load("BiomePrefab"));
        BaseBiome  baseBiome   = biomeObject.GetComponent <BaseBiome>();

        Array values = Enum.GetValues(typeof(TypeBiome));

        baseBiome.currentBiome = (TypeBiome)values.GetValue(baseBiome.random.Next(values.Length));

        baseBiome.CreateEncounter();

        return(baseBiome);
    }
예제 #3
0
 public void Generate(GameObject chunk, BaseChunkShape chunkShape, BaseBiome biome, bool buffered)
 {
     foreach (var feature in chunkShape.Map)
     {
         if (feature.TileType == BaseChunkShape.TileTypes.Powerup)
         {
             if (Random.Range(0, 3) == 0)
             {
                 worldGenerator.CreateTile(chunk, powerupHatPrefab, feature.Rect.xMin, feature.Rect.yMin);
             }
             else if (Random.Range(0, 5) == 0)
             {
                 worldGenerator.CreateTile(chunk, powerupBonusPrefab, feature.Rect.xMin, feature.Rect.yMin);
             }
         }
     }
 }
예제 #4
0
    public void Generate(GameObject chunk, BaseChunkShape chunkShape, BaseBiome biome, bool buffered)
    {
        if (GameManager.Instance.Area == GameManager.Areas.Bonus)
        {
            return;
        }

        foreach (var feature in chunkShape.Map)
        {
            if (feature.TileType == BaseChunkShape.TileTypes.Tier1Enemy)
            {
                var    r      = Random.Range(0, 3);
                Object prefab = null;
                if (r == 0)
                {
                    prefab = enemyTier1Prefab;
                }
                if (r == 1)
                {
                    prefab = enemyVinePrefab;
                }

                if (prefab != null)
                {
                    for (var x = (int)feature.Rect.xMin; x < (int)feature.Rect.xMax; x += 2)
                    {
                        for (var y = (int)feature.Rect.yMin; y < (int)feature.Rect.yMax; y += 2)
                        {
                            worldGenerator.CreateTile(chunk, prefab, x, y);
                        }
                    }
                }
            }
            if (feature.TileType == BaseChunkShape.TileTypes.Spike)
            {
                for (var x = (int)feature.Rect.xMin; x < (int)feature.Rect.xMax; x++)
                {
                    for (var y = (int)feature.Rect.yMin; y < (int)feature.Rect.yMax; y++)
                    {
                        worldGenerator.CreateTile(chunk, spikePrefab, x, y);
                    }
                }
            }
        }
    }
예제 #5
0
    public void CreateBiome(int i)
    {
        BaseBiome newBiome = GenerateBiome();

        newBiome.initSprite(BiomeSprite[random.Next(BiomeSprite.Count)]);
        newBiome.baseEncounter.initSpriteEncounter(EncounterSprite[random.Next(EncounterSprite.Count)]);

        AddBiome(newBiome);
        if (i == 0)
        {
            newBiome.transform.SetParent(transform.Find("BiomePrincipal"));
            newBiome.GetComponent <Button>().enabled = false;
        }
        else
        {
            newBiome.transform.SetParent(transform.Find("BiomeChoix"));
        }
    }
예제 #6
0
    public void UpdateAllBiome()
    {
        BaseBiome waitingCleanBiome = null;

        int checkSelected = -1;

        for (int i = 0; i < biomes.Count; i++)
        {
            if (i != 0 && biomes[i].selected > checkSelected)
            {
                waitingCleanBiome = biomes[i];
                checkSelected     = biomes[i].selected;
            }
        }



        foreach (BaseBiome biome in biomes)
        {
            if (biome != waitingCleanBiome)
            {
                Destroy(biome.gameObject);
            }
        }
        biomes.Clear();

        biomes.Add(waitingCleanBiome);
        biomes[0].GetComponent <Button>().enabled = false;
        biomes[0].transform.SetParent(transform.Find("BiomePrincipal"));
        biomes[0].baseEncounter.ApplyEffect();


        for (int i = 0; i < 3; i++)
        {
            BaseBiome newBiome = GenerateBiome();

            newBiome.initSprite(BiomeSprite[random.Next(BiomeSprite.Count)]);
            newBiome.baseEncounter.initSpriteEncounter(EncounterSprite[random.Next(EncounterSprite.Count)]);
            AddBiome(newBiome);

            newBiome.transform.SetParent(transform.Find("BiomeChoix"));
        }
    }
예제 #7
0
    private GameObject GenerateWorldChunk(float positionX, bool buffered)
    {
        Debug.Log("new chunk at " + positionX);
        var eligibleChunkShapes = chunkShapes.Where(x => GameManager.Instance.distanceTraveled >= x.Difficulty - 1).ToList();

        var            chunk = (GameObject)Instantiate(worldChunkPrefab, new Vector3(positionX, GameManager.Instance.Area == GameManager.Areas.Bonus ? 100 : 0, 0), new Quaternion(0, 0, 0, 0));
        BaseChunkShape shape;

        if (buffered == false)
        {
            shape = new FlatShape();
        }
        else
        {
            shape = eligibleChunkShapes.RandomElement();
        }

        BaseBiome biome;

        if (buffered == false || lastBiome == null || lastBiome.IsSpecial)
        {
            biome = new GrassBiome();
        }
        else
        {
            biome = biomes.Choose();
        }

        chunkGenerator.Generate(chunk, shape, biome, buffered);
        coinGenerator.Generate(chunk, shape, biome, buffered);
        powerupGenerator.Generate(chunk, shape, biome, buffered);
        if (GameManager.Instance.distanceTraveled > 1)
        {
            enemyGenerator.Generate(chunk, shape, biome, buffered);
        }

        lastChunkPosX = (int)positionX;
        lastBiome     = biome;
        Debug.Log("lastChunkPosX = " + lastChunkPosX);
        return(chunk);
    }
예제 #8
0
 public IEnumerator GenerateCoroutine(GameObject chunk, BaseChunkShape chunkShape, BaseBiome biome, bool buffered)
 {
     if (biome.GetType() == typeof(BonusBiome))
     {
         for (int x = 0; x < 50; x++)
         {
             for (int y = 1; y < 7; y++)
             {
                 worldGenerator.CreateTile(chunk, biome.coinPrefab, x, y);
                 if (buffered)
                 {
                     yield return(new WaitForEndOfFrame());
                 }
             }
         }
     }
     else
     {
         foreach (var feature in chunkShape.Map)
         {
             if (feature.TileType == BaseChunkShape.TileTypes.Coin)
             {
                 for (int x = (int)feature.Rect.xMin; x < (int)feature.Rect.xMax; x++)
                 {
                     for (int y = (int)feature.Rect.yMin; y < (int)feature.Rect.yMax; y++)
                     {
                         worldGenerator.CreateTile(chunk, biome.coinPrefab, x, y);
                     }
                 }
                 if (buffered)
                 {
                     yield return(new WaitForEndOfFrame());
                 }
             }
         }
     }
 }
예제 #9
0
 public void Generate(GameObject chunk, BaseChunkShape chunkShape, BaseBiome biome, bool buffered)
 {
     worldGenerator.StartChildCoroutine(GenerateCoroutine(chunk, chunkShape, biome, buffered));
 }
예제 #10
0
    public IEnumerator GenerateCoroutine(GameObject chunk, BaseChunkShape chunkShape, BaseBiome biome, bool buffered)
    {
        Debug.Log("generating " + chunkShape.Map.Count);
        if (biome.backgroundPrefab != null)
        {
            worldGenerator.CreateBG(chunk, biome.backgroundPrefab);
        }

        // ragged top
        for (int x = 0; x < worldGenerator.chunkWidth; x++)
        {
            for (int y = (int)worldGenerator.chunkHeight - 2; y < worldGenerator.chunkHeight; y++)
            {
                if (Random.Range(0, 2) == 0)
                {
                    var tile = worldGenerator.CreateTile(chunk, new Color(0.2f, 0.2f, 0.2f), x, y);
                }
            }
        }

        foreach (var feature in chunkShape.Map)
        {
            switch (feature.TileType)
            {
            case BaseChunkShape.TileTypes.Air:
                break;

            case BaseChunkShape.TileTypes.Liquid:
                for (int x = (int)feature.Rect.xMin; x < (int)feature.Rect.xMax; x++)
                {
                    for (int y = (int)feature.Rect.yMin; y < (int)feature.Rect.yMax; y++)
                    {
                        worldGenerator.CreateTile(chunk, liquidPrefab, x, y);
                    }
                }
                break;

            case BaseChunkShape.TileTypes.Platform:
                worldGenerator.CreatePlatform(chunk, feature.Rect);
                worldGenerator.CreateTiles(chunk, biome.tileColor, feature.Rect);
                break;

            case BaseChunkShape.TileTypes.Platform50p:
                if (Random.Range(0, 2) == 0)
                {
                    worldGenerator.CreatePlatform(chunk, feature.Rect);
                    worldGenerator.CreateTiles(chunk, biome.tileColor, feature.Rect);
                }
                break;

            default:
                break;
            }
            //if (buffered)
            //    yield return new WaitForEndOfFrame();
        }

        yield return(null);
    }
예제 #11
0
 void AddBiome(BaseBiome newBiome)
 {
     biomes.Add(newBiome);
 }
예제 #12
0
 public static Biomes GetBiome(int worldX, int worldZ, OverworldTerrain noiseGen)
 {
     BaseBiome bn = noiseGen.GetBiome(worldX, worldZ);
     return (Biomes)bn;
 }