//génération aléatoire des points private Vertex3[] GenerateBiome() { Debug.Log("enter in GenerateBiome()"); int i = 0; Vertex3[] vertices = new Vertex3[numberOfPlayer + numberOfVertices + 1]; //Génération aléatoire des points pour planètes spawns for (i = 0; i <= numberOfPlayer; i++) { var x = size * Random.Range(-0.7f, 0.7f); var y = size * Random.Range(-1f, -1.2f); var z = size * Random.Range(-0.7f, 0.7f); //vertices[i] = new Vertex3(x, y, z); PhotonNetwork.Instantiate(spawnPlanet.name, new Vector3(x, y, z), Quaternion.identity); } //Génération aléatoire des points pour planètes basics for (i = 0; i <= numberOfVertices; i++) { planetSize = Random.Range(scaleMin, scaleMax); var x = size * Random.Range(-1.0f, 1.0f); var y = size * Random.Range(-1.0f, 1.0f); var z = size * Random.Range(-1.0f, 1.0f); //vertices[i] = new Vertex3(x, y, z); //newPlanet.planetLocation = vertices[i]; var planetGameObject = PhotonNetwork.Instantiate(basicPlanet.name, new Vector3(x, y, z), Quaternion.identity); planetGameObject.transform.localScale = new Vector3(planetSize, planetSize, planetSize); var planetClass = planetsClass[i]; planetClass.gameObjectPlanet = planetGameObject; //assignation d'un biome planetClass.planetType = PlanetFeature_PUN.CreateBiome(basicPlanet, out matName); Material mat = Resources.Load(matName, typeof(Material)) as Material; planetClass.gameObjectPlanet.GetComponent <Renderer>().material = mat; //instanciation assets //AssetInstanciation_PUN asset = planetClass.gameObjectPlanet.GetComponent<AssetInstanciation_PUN>(); //asset.type = (int)planetClass.planetType; //asset.SpawnAssets(); } PhotonNetwork.Instantiate(victoryPlanet.name, new Vector3(0, size * Random.Range(1f, 1.2f), 0), Quaternion.identity); victoryPlanet.transform.localScale = new Vector3(planetSize / 2, planetSize / 2, planetSize / 2); return(vertices); }
//génération aléatoire des points //TODO : set size of the planet and push points private void SetPlanetStruct() { //Random.state = seedServeur; int i = 0; //Génération aléatoire des points pour planètes spawns for (i = 0; i <= numberOfPlayer; i++) { var x = size * Random.Range(-0.7f, 0.7f); var y = size * Random.Range(-1f, -1.2f); var z = size * Random.Range(-0.7f, 0.7f); planetsData[i].planetID = i; planetsData[i].planetLocation = new Vector3(x, y, z); planetsData[i].gameObjectPlanet = spawnPlanet; } //Génération aléatoire des points pour planètes basics for (; i <= numberOfVertices; i++) { var x = size * Random.Range(-1.0f, 1.0f); var y = size * Random.Range(-1.0f, 1.0f); var z = size * Random.Range(-1.0f, 1.0f); planetsData[i].planetID = i; planetsData[i].planetLocation = new Vector3(x, y, z); planetsData[i].radiusPlanet = (float)Random.Range(scaleMin, scaleMax); planetsData[i].planetType = PlanetFeature_PUN.CreateBiome(basicPlanet, out matName); planetsData[i].gameObjectPlanet = basicPlanet; Material mat = Resources.Load(matName, typeof(Material)) as Material; planetsData[i].gameObjectPlanet.GetComponent <Renderer>().material = mat; } }