Beispiel #1
0
	// Use this for initialization
	void Start () {
		if (IsGetFromDatabase) {
			LoadModelFromDataBase ();
		} else {	// generate new mesh
			MyBlockMesher = new BlockMesher();
			//	MyBlockStructure = GetManager.GetDataManager ().GetBlockStructure(MyBlockStructureName);
			MyBlockStructure.Reset ();
			if (IsVaryScale) {
				float CurrentSize = MyBlockStructure.MyBlocks.Scale.x;
				float NewSize = CurrentSize * (Random.Range (MinimumVariation, MaximumVariation));
				MyBlockStructure.MyBlocks.Scale += new Vector3 (NewSize, NewSize, NewSize);
				//MyBlockStructure.MyBlockTypes[0] = Random.Range(1,12);
			}
			//MyBlockStructure.UpdateBlockStructureWithType();
			if (Type == 0) {
				MyBlockStructure.Sphere (Random.Range (1, 12), SphereSize);	//	7 for cores
				MyBlockStructure.AddNoise (NoiseValue);
			} else {
				MyBlockStructure.MyBlocks.Size.y = 8;
				MyBlockStructure.Reset ();
				MyBlockStructure.Cylinder (2, SphereSize);
			}
			MyMesh = new MyMesh ();
			MyBlockMesher.UpdateMeshesOnThread (MyMesh, MyBlockStructure.MyBlocks);
		}
	}
Beispiel #2
0
	// Use this for initialization
	void Start () {
		GenerateBlockData ();
		GenerateBlockModels ();
		// i should save/load all data here
		GenerateItemsForBlocks ();
		for (int i = 0; i < BlockStructuresList.Count; i++) {
			if (!BlockStructuresList[i].HasInitiated) {
				BlockStructuresList[i].Reset();
				BlockStructuresList[i].UpdateBlockStructureWithType();
			}
			// for my models! - create a meshes for them in thread
			BlockMesher NewTerrain = new BlockMesher();
			BlockMeshers.Add (NewTerrain);

			MyMesh NewMesh = new MyMesh();
			MeshesList.Add (NewMesh);
			NewTerrain.UpdateMeshesOnThread(NewMesh, BlockStructuresList[i].MyBlocks);
		}
		for (int i = 0; i < MazeList.Count; i++) {
			MazeList [i].Reset ();
			//MazeList [i].GenerateDungeon ();

		}
		// only use voxel models from now on lel
		ModelsList.Clear ();	
	}