/// <summary>
        /// Destroyes everything and initializes world
        /// </summary>
        void LoadWorldInt()
        {
            DisposeAll();

            if (world == null)
            {
                if (Application.isPlaying)
                {
                    world = ScriptableObject.CreateInstance <WorldDefinition> ();
                    Debug.LogWarning("World Definition asset missing in Voxel Play Environment. Assigning a temporary asset.");
                }
                else
                {
                    return;
                }
            }

            // Create world root
            if (worldRoot == null)
            {
                GameObject wr = GameObject.Find(VOXELPLAY_WORLD_ROOT);
                if (wr == null)
                {
                    wr = new GameObject(VOXELPLAY_WORLD_ROOT);
                    wr.transform.position = Misc.vector3zero;
                }
                worldRoot = wr.transform;
            }

            WorldRand.Randomize(world.seed);
            Physics.gravity = new Vector3(0, world.gravity, 0);
            InitSaveGameStructs();
            InitWater();
            InitSky();
            InitRenderer();
            InitTrees();
            InitVegetation();
            LoadWorldTextures();
            InitItems();
            InitNavMesh();
            InitChunkManager();
            NotifyCameraMove();  // forces check chunks in frustum
            if (applicationIsPlaying)
            {
                Invoke("InitClouds", 3f);
            }
            //InitClouds ();
            InitPhysics();
            InitParticles();
            InitTileRules();
            UpdateMaterialProperties();
            SetBuildMode(buildMode);
        }
Пример #2
0
 static WorldRand()
 {
     WorldRand.Randomize(0);
 }