Ejemplo n.º 1
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else if (instance != this)
     {
         // Destroy the current object, so there is just one
         Destroy(gameObject);
     }
 }
Ejemplo n.º 2
0
        void AssignConfigData(ref WorldGenData data)
        {
            data.minMountainHeight = minMountainHeight.Value;
            data.minAshlandsDist   = minAshlandsDist.Value;
            data.minDeepNorthDist  = minDeepNorthDist.Value;

            data.swampBiomeScaleX = swampBiomeScaleX.Value;
            data.swampBiomeScaleY = swampBiomeScaleY.Value;
            data.minSwampNoise    = minSwampNoise.Value;
            data.minSwampDist     = minSwampDist.Value;
            data.maxSwampDist     = maxSwampDist.Value;
            data.minSwampHeight   = minSwampHeight.Value;
            data.maxSwampHeight   = maxSwampHeight.Value;

            data.mistlandsBiomeScaleX = mistlandsBiomeScaleX.Value;
            data.mistlandsBiomeScaleY = mistlandsBiomeScaleY.Value;
            data.minMistlandsNoise    = minMistlandsNoise.Value;
            data.minMistlandsDist     = minMistlandsDist.Value;
            data.maxMistlandsDist     = maxMistlandsDist.Value;

            data.plainsBiomeScaleX = plainsBiomeScaleX.Value;
            data.plainsBiomeScaleY = plainsBiomeScaleY.Value;
            data.minPlainsNoise    = minPlainsNoise.Value;
            data.minPlainsDist     = minPlainsDist.Value;
            data.maxPlainsDist     = maxPlainsDist.Value;

            data.blackForestBiomeScaleX = blackForestBiomeScaleX.Value;
            data.blackForestBiomeScaleY = blackForestBiomeScaleY.Value;
            data.minBlackForestNoise    = minBlackForestNoise.Value;
            data.minBlackForestDist     = minBlackForestDist.Value;
            data.maxBlackForestDist     = maxBlackForestDist.Value;

            data.meadowsSwitch     = AssignSwitch(meadowsSwitch.Value);
            data.blackForestSwitch = AssignSwitch(blackForestSwitch.Value);
            data.swampSwitch       = AssignSwitch(swampSwitch.Value);
            data.mountainSwitch    = AssignSwitch(mountainSwitch.Value);
            data.plainsSwitch      = AssignSwitch(plainsSwitch.Value);
            data.mistlandsSwitch   = AssignSwitch(mistlandsSwitch.Value);
            data.ashlandsSwitch    = AssignSwitch(ashlandsSwitch.Value);
            data.deepNorthSwitch   = AssignSwitch(deepNorthSwitch.Value);


            data.riverMultipleMaxDistance = riverMultipleMaxDistance.Value;
            data.riverExtremeMaxDistance  = riverExtremeMaxDistance.Value;
            data.riverMaxHeight           = riverMaxHeight.Value;
            data.riverWidthMaxUpperRange  = riverWidthMaxUpperRange.Value;
            data.riverWidthMaxLowerRange  = riverWidthMaxLowerRange.Value;
            data.riverWidthMinLowerRange  = riverWidthMinLowerRange.Value;
            data.riverCurveWidth          = riverCurveWidth.Value;
            data.riverWavelength          = riverWaveLength.Value;
        }
Ejemplo n.º 3
0
        public static void Prefix(World world)
        {
            if (world.m_menu)
            {
                return;
            }

            FileStream biomeStream = null;

            try
            {
                biomeStream = File.OpenRead(SavingData.GetBiomeSavePath(world));
            }
            catch
            {
                if (biomeStream == null)
                {
                    UnityEngine.Debug.Log("No biome data found.");
                    WorldGenOptions.GenOptions.hasBiomeData = false;
                    WorldGenOptions.GenOptions.usingData    = WorldGenOptions.GenOptions.defaultData;
                    return;
                }
            }
            UnityEngine.Debug.Log("Biome data found for " + world.m_name + ".");
            WorldGenOptions.GenOptions.hasBiomeData = true;
            WorldGenData data = new WorldGenData();

            try
            {
                BinaryReader reader  = new BinaryReader(biomeStream);
                int          count   = reader.ReadInt32();
                ZPackage     package = new ZPackage(reader.ReadBytes(count));
                data.ReadBiomeData(ref package);
            }
            catch
            {
                ZLog.LogWarning("Incomplete biome data for " + world.m_name);
            }
            finally
            {
                if (biomeStream != null)
                {
                    biomeStream.Dispose();
                }
                WorldGenOptions.GenOptions.usingData = data;
            }
        }
Ejemplo n.º 4
0
    public static void Generate(World world, List <Sprite> speciesSprites, WorldData data, WorldGenData worldGenData, int seed)
    {
        world.Data = data;
        world.Init(worldGenData.Size, world.Data);

        ref var   state = ref world.States[0];