//this function will create and destroy the ground public void GroundGeneration() { //Initialisation if (nbGroundCreate == 0) { //First ground //GameObject newGround1 = Instantiate(ground); GroundLevel ground1 = new GroundLevel(ground); nbGroundActual++; nbGroundCreate++; listGround.Add(ground1); //We add it to our list Debug.Log("First ground : " + ground1.mainGroundPosition()); //second ground // GameObject newGround2 = Instantiate(ground); Vector3 ground2Position = new Vector3(0, 0, ground.transform.localScale.z * 10); GroundLevel ground2 = new GroundLevel(ground, ground2Position, listObstaclesSize1, listObstaclesSize2, nbGroundSeen, nbGroundCreate, nbGroundActual); //erreur potentielle nbGroundActual++; nbGroundCreate++; listGround.Add(ground2); //We add it to our list Debug.Log("Second ground : " + ground2.mainGroundPosition()); //third ground //GameObject newGround3 = Instantiate(ground); Vector3 ground3Position = new Vector3(0, 0, 2 * ground.transform.localScale.z * 10); GroundLevel ground3 = new GroundLevel(ground, ground3Position, listObstaclesSize1, listObstaclesSize2, nbGroundSeen, nbGroundCreate, nbGroundActual); nbGroundActual++; nbGroundCreate++; listGround.Add(ground3); //We add it to our list Debug.Log("Third ground : " + ground3.mainGroundPosition()); } //The player's position is enough to destroy an old ground and generate a new one if (checkPlayerPositionResult && autorisationDestruction) { //We destroy the oldest ground listGround[0].DestoyGroundLevel(); listGround.RemoveAt(0); nbGroundActual--; autorisationDestruction = false; //We need to turn it off, of all the ground will be destroy, we need for the player to reach the next ground to turn it on true again } while (nbGroundActual < 3) { //generate one Vector3 newPosition = new Vector3(0, 0, nbGroundCreate * actualGroundScale.z); //setting is new position GroundLevel newGroundLevel = new GroundLevel(ground, newPosition, listObstaclesSize1, listObstaclesSize2, nbGroundSeen, nbGroundCreate, nbGroundActual); //The generation of a new ground will be call here //erreur potentielle nbGroundActual++; //Update of the numbers nbGroundCreate++; listGround.Add(newGroundLevel); //We add it to our list } }
public override int GetHashCode() { unchecked { var hashCode = Temp.GetHashCode(); hashCode = (hashCode * 397) ^ TempMin.GetHashCode(); hashCode = (hashCode * 397) ^ TempMax.GetHashCode(); hashCode = (hashCode * 397) ^ Pressure.GetHashCode(); hashCode = (hashCode * 397) ^ SeaLevel.GetHashCode(); hashCode = (hashCode * 397) ^ GroundLevel.GetHashCode(); hashCode = (hashCode * 397) ^ Humidity.GetHashCode(); return(hashCode); } }
protected bool Equals(MainValues other) { return(Temp.Equals(other.Temp) && TempMin.Equals(other.TempMin) && TempMax.Equals(other.TempMax) && Pressure.Equals(other.Pressure) && SeaLevel.Equals(other.SeaLevel) && GroundLevel.Equals(other.GroundLevel) && Humidity.Equals(other.Humidity)); }