public InterfaceTerrainInfo(InterfaceTerrainTool interfaceTerrainTool, InterfaceTerrainGroundStyle interfaceTerrainGroundStyle, InterfaceTerrainGroundGrain interfaceTerrainGroundGrain) { this.interfaceTerrainTool = interfaceTerrainTool; this.interfaceTerrainType = InterfaceTerrainType.Ground; this.interfaceTerrainGroundStyle = interfaceTerrainGroundStyle; this.interfaceTerrainGroundGrain = interfaceTerrainGroundGrain; }
string InterfaceTerrainGroundGrainToText(InterfaceTerrainGroundGrain t) { string s = ""; switch (t) { case InterfaceTerrainGroundGrain.VeryCoarse: s = "Very coarse"; break; case InterfaceTerrainGroundGrain.Coarse: s = "Coarse"; break; case InterfaceTerrainGroundGrain.Normal: s = "Normal"; break; case InterfaceTerrainGroundGrain.Fine: s = "Fine"; break; case InterfaceTerrainGroundGrain.VeryFine: s = "Very fine"; break; default: s = "???"; break; } return(s); }
protected float InterfaceTerrainGroundGrainToTerrainSegmentLength(InterfaceTerrainGroundGrain interfaceTerrainGroundGrain) { float segmentLength; switch (interfaceTerrainGroundGrain) { case InterfaceTerrainGroundGrain.VeryCoarse: segmentLength = 5f; break; case InterfaceTerrainGroundGrain.Coarse: segmentLength = 4f; break; case InterfaceTerrainGroundGrain.Normal: segmentLength = 3f; break; case InterfaceTerrainGroundGrain.Fine: segmentLength = 2f; break; case InterfaceTerrainGroundGrain.VeryFine: segmentLength = 1f; break; default: Debug.LogError("Cannot find a matching segmentLength for InterfaceTerrainGroundGrain [" + interfaceTerrainGroundGrain + "]. Defaulting to InterfaceTerrainGroundGrain.Normal"); goto case InterfaceTerrainGroundGrain.Normal; } return(segmentLength); }
override public TextMenuText Text() { string t; t = "_Current settings_\n" + "(QE) Tool: " + InterfaceTerrainToolToText(terrainTool) + "\n" + "(123...) Style: " + InterfaceTerrainGroundStyleToText(terrainGroundStyle) + "\n" + "(ZX) Grain: " + InterfaceTerrainGroundGrainToText(terrainGroundGrain); // Tool if (Input.GetKeyDown(KeyCode.Q)) { terrainTool--; if ((int)terrainTool < 0) { terrainTool = 0; } } if (Input.GetKeyDown(KeyCode.E)) { terrainTool++; if ((int)terrainTool >= terrainToolMax) { terrainTool = (InterfaceTerrainTool)terrainToolMax - 1; } } // Style if (Input.GetKeyDown(KeyCode.Alpha1)) { terrainGroundStyle = InterfaceTerrainGroundStyle.Grass; updateTerrainGroundStyle = true; } if (Input.GetKeyDown(KeyCode.Alpha2)) { terrainGroundStyle = InterfaceTerrainGroundStyle.Snow; updateTerrainGroundStyle = true; } if (Input.GetKeyDown(KeyCode.Alpha3)) { terrainGroundStyle = InterfaceTerrainGroundStyle.Desert; updateTerrainGroundStyle = true; } if (Input.GetKeyDown(KeyCode.Alpha4)) { terrainGroundStyle = InterfaceTerrainGroundStyle.Stonebrick; updateTerrainGroundStyle = true; } if (Input.GetKeyDown(KeyCode.Alpha5)) { terrainGroundStyle = InterfaceTerrainGroundStyle.Grass2; updateTerrainGroundStyle = true; } // Grain if (Input.GetKeyDown(KeyCode.Z)) { terrainGroundGrain--; if ((int)terrainGroundGrain < 0) { terrainGroundGrain = (InterfaceTerrainGroundGrain)0; } updateTerrainGroundGrain = true; } if (Input.GetKeyDown(KeyCode.X)) { terrainGroundGrain++; if ((int)terrainGroundGrain > terrainGroundGrainMax - 1) { terrainGroundGrain = (InterfaceTerrainGroundGrain)terrainGroundGrainMax - 1; } updateTerrainGroundGrain = true; } // Return to previous menu if (Input.GetKeyDown(KeyCode.Escape)) { SetMenu(TextMenu.Terrain); } Draw(new InterfaceTerrainInfo(terrainTool, terrainGroundStyle, terrainGroundGrain)); string t2 = ""; // Find currently selected object if (editorController.currentTerrain is TerrainGround) { TerrainGround ground = (TerrainGround)editorController.currentTerrain; bool regenerate = false; bool reloadSprites = false; // Update the roller settings in real-time if (updateTerrainGroundStyle) { updateTerrainGroundStyle = false; regenerate = true; reloadSprites = true; ground.style = InterfaceTerrainGroundStyleToTerrainGroundStyle(terrainGroundStyle); } if (updateTerrainGroundGrain) { updateTerrainGroundGrain = false; regenerate = true; ground.segmentLength = InterfaceTerrainGroundGrainToTerrainSegmentLength(terrainGroundGrain); } // Apply the updates if (reloadSprites) { ground.groundPart.ReloadSprites(); } if (regenerate) { ground.Regenerate(); } t2 = "_Selection settings_\n" + " Style: " + ground.style + "\n" + "Seg. len.: " + ground.segmentLength; } return(new TextMenuText(t, t2)); }