private LightCommand CreateColourCommand(HueColour colour) { var command = new LightCommand(); command.On = true; command.SetColor(colour.ToRGBColour()); return(command); }
private static void ColorToggle(HueColour.HueColorNames color) { SaveLoadManager slm = Singleton <SaveLoadManager> .Instance; Color textColor = HueColour.HueColourValue(color); GUIStyle style = new GUIStyle(GUI.skin.toggle); style.normal.textColor = textColor; style.onNormal.textColor = textColor; bool unlocked = GUILayout.Toggle(slm.IsColourUnlocked(color), color.ToString(), style); slm.SetColourUnlocked(color, unlocked); }
public static RGBColor ToRGBColour(this HueColour colour) { RGBColor outColour; switch (colour) { case HueColour.Red: outColour = new RGBColor("FF0000"); break; case HueColour.Orange: outColour = new RGBColor("FFA500"); break; case HueColour.Yellow: outColour = new RGBColor("FFFF00"); break; case HueColour.Green: outColour = new RGBColor("00FF00"); break; case HueColour.Blue: outColour = new RGBColor("0000FF"); break; case HueColour.Indigo: outColour = new RGBColor("4B0082"); break; case HueColour.Violet: outColour = new RGBColor("EE82EE"); break; case HueColour.White: outColour = new RGBColor("FFFFFF"); break; default: outColour = new RGBColor("FFFFFF"); break; } return(outColour); }
private static void AddLevelsByRegion() { GUILayout.Label("Region - Village"); AddLevelButton("IntroDream"); AddLevelButton("Village"); AddLevelButton("Lighthouse"); AddLevelButton("OldLadyHouse"); AddLevelButton("CycleHouse"); AddLevelButton("ThinHouse"); GUILayout.Label("Region - Caves"); AddLevelButton("CaveMinerArea"); GUILayout.Label("Region - Water"); AddLevelButton("WaterEntrance"); AddLevelButton("Waterfall"); AddLevelButton("DropThroughColour"); AddLevelButton("PullTute02"); AddLevelButton("SpikeTute03"); AddLevelButton("JumpColour"); AddLevelButton("BoulderTutorialNew01"); AddLevelButton("BoulderDropChase02"); AddLevelButton("BoulderTrap02"); AddLevelButton("PurpleFragmentRoom", HueColour.HueColourValue(HueColour.HueColorNames.Purple)); AddLevelButton("PostPurpleCorridor"); AddLevelButton("AlternatingColourSwitch"); AddLevelButton("FallThroughColours"); AddLevelButton("AlternatingColourJumps02"); AddLevelButton("ClimbUpColours02"); AddLevelButton("OrangeFragmentRoom", HueColour.HueColourValue(HueColour.HueColorNames.Orange)); AddLevelButton("WaterExit"); GUILayout.Label("Region - Fire"); AddLevelButton("FireIntro"); AddLevelButton("PuzzleSequence"); AddLevelButton("KeyTutorial"); AddLevelButton("JumpAlign"); AddLevelButton("BoulderSwitchChase"); AddLevelButton("HueDunnit"); AddLevelButton("SkeletonRoom"); AddLevelButton("AlternatingBoulders"); AddLevelButton("PinkFragmentRoom", HueColour.HueColourValue(HueColour.HueColorNames.Pink)); AddLevelButton("PostPinkCorridor"); AddLevelButton("BoxSlideMaze"); AddLevelButton("BrickMaze"); AddLevelButton("NarrowCorridorCrates"); AddLevelButton("BlackBoxDecoy"); AddLevelButton("CrushOnStart"); AddLevelButton("CrumblingRockJump"); AddLevelButton("SlideAcrossTheGap"); AddLevelButton("RedFragmentRoom", HueColour.HueColourValue(HueColour.HueColorNames.Red)); AddLevelButton("PostRedCorridor"); GUILayout.Label("Region - Temple"); AddLevelButton("TempleIntro"); AddLevelButton("CrateSequence"); AddLevelButton("BoulderPressurepads"); AddLevelButton("PressurePadSlide"); AddLevelButton("ThwompTutorial"); AddLevelButton("ThwompTrigger"); AddLevelButton("ThwompClimb"); AddLevelButton("CrateThwompRetrieve"); AddLevelButton("BlueFragmentRoom", HueColour.HueColourValue(HueColour.HueColorNames.Blue)); AddLevelButton("PostBlueCorridor"); AddLevelButton("LongCratePressure"); AddLevelButton("BalloonThwompJump"); AddLevelButton("BalloonSwitchJump"); AddLevelButton("BalloonDecoy"); AddLevelButton("BalloonMaze"); AddLevelButton("ThwompRunner"); AddLevelButton("YellowFragmentRoom", HueColour.HueColourValue(HueColour.HueColorNames.Yellow)); AddLevelButton("PostYellowCorridor"); GUILayout.Label("Region - Tech"); AddLevelButton("TechHub"); AddLevelButton("TechIntro"); AddLevelButton("LaserTutorial"); AddLevelButton("LaserJumpSwitch"); AddLevelButton("LaserMovingSwitch"); AddLevelButton("LaserCrateBlock"); AddLevelButton("LaserClimb"); AddLevelButton("PipePush"); AddLevelButton("LaserPlatformMadness1"); AddLevelButton("LaserPlatformMadness2"); AddLevelButton("LaserActivatedTutorial"); AddLevelButton("LaserDoors"); AddLevelButton("LaserBalloonMaze"); AddLevelButton("ThwompLaserRunner"); AddLevelButton("LimeFragmentRoom", HueColour.HueColourValue(HueColour.HueColorNames.Lime)); AddLevelButton("PostLimeCorridor"); AddLevelButton("LeverTutorial"); AddLevelButton("LaserHeights"); AddLevelButton("PlatformBlockLasers"); AddLevelButton("LeverMadness"); AddLevelButton("TechToLighthouse"); GUILayout.Label("Region - Island"); AddLevelButton("IslandPort"); AddLevelButton("MountainsEntrance"); AddLevelButton("MountainsBounceIntro"); AddLevelButton("MountainsPostBounceIntro"); AddLevelButton("BounceToDeath"); AddLevelButton("MountainsBounceKeyRetrieve"); AddLevelButton("BounceSpikePit"); AddLevelButton("MountainsZigZag"); AddLevelButton("BounceThwompDash"); AddLevelButton("MountainsBounceLaserIntro"); AddLevelButton("BounceCrateDrag"); AddLevelButton("BouncePit"); AddLevelButton("BounceConveyer"); AddLevelButton("LaserBounceChange"); GUILayout.Label("Region - University"); AddLevelButton("UniversityOutside"); AddLevelButton("UniversityLobby"); AddLevelButton("BasementGoo"); AddLevelButton("UniLetterCorridor"); AddLevelButton("GooBalloonPressure"); AddLevelButton("GooPressure"); AddLevelButton("Courtyard1"); AddLevelButton("ConveyerGoo"); AddLevelButton("GooBalloonDip"); AddLevelButton("TrophyRoom"); AddLevelButton("ThwompDoubleLaser"); AddLevelButton("UniGooStairs"); AddLevelButton("Courtyard2"); AddLevelButton("BounceGooIntro"); AddLevelButton("GooBalloonCrates"); AddLevelButton("MovingGoo"); AddLevelButton("Courtyard3"); AddLevelButton("ThwompGoo"); AddLevelButton("HiddenDoorCorridor"); AddLevelButton("SecretRoom"); AddLevelButton("UniSlide"); AddLevelButton("UniGooStairsDown"); AddLevelButton("ThwompGooClimb"); AddLevelButton("UniRooftop"); AddLevelButton("MumRoom"); AddLevelButton("OutroDream"); }
public void CreatePlanet() { // Create an icosahedron, subdivide it three times so that we have plenty of polys to work with. m_NumberOfContinents = minNumContinents; System.Random rnd = new System.Random(); //planetSize = rnd.Next(1, 11); planetSize = 10; InitAsIcosohedron(planetSize); Subdivide(3); // When we begin extruding polygons, we'll need each one to know who its immediate //neighbors are. Calculate that now. CalculateNeighbors(); // By default, everything is colored blue. As we extrude land forms, we'll change their colors to match. // Picks a random planet type initially planetType = (PlanetType)rnd.Next(5); //planetType = PlanetType.Volcanic; // = new Color32(255, 0, 255, 255); hot pink switch (planetType) { case PlanetType.Earthlike: colorOcean = new Color32(0, 80, 220, 0); colorGrass = new Color32(0, 220, 0, 0); colorDirt = new Color32(180, 140, 20, 0); colorDeepOcean = new Color32(0, 40, 110, 0); break; case PlanetType.Volcanic: //colorOcean = new Color32(0, 80, 220, 0); colorOcean = HueColour.HueColourValue(HueColour.HueColorNames.Red); colorGrass = HueColour.HueColourValue(HueColour.HueColorNames.GrayDark); colorDirt = HueColour.HueColourValue(HueColour.HueColorNames.RedDeep); colorDeepOcean = HueColour.HueColourValue(HueColour.HueColorNames.RedDeep); break; default: colorOcean = new Color32(0, 80, 220, 0); colorGrass = new Color32(0, 220, 0, 0); colorDirt = new Color32(180, 140, 20, 0); colorDeepOcean = new Color32(0, 40, 110, 0); break; } //pick the planet size attributes m_NumberOfContinents = rnd.Next(1, 10); m_NumberOfHills = rnd.Next(0, 10); foreach (Polygon p in m_Polygons) { p.m_Color = colorOcean; } // Now we build a set of Polygons that will become the land. We do this by generating // randomly sized spheres on the surface of the planet, and adding any Polygon that falls // inside that sphere. PolySet landPolys = new PolySet(); PolySet sides; // Grab polygons that are inside random spheres. These will be the basis of our planet's continents. for (int i = 0; i < m_NumberOfContinents; i++) { float continentSize = Random.Range(m_ContinentSizeMin, m_ContinentSizeMax); PolySet newLand = GetPolysInSphere(Random.onUnitSphere, continentSize, m_Polygons); landPolys.UnionWith(newLand); } // While we're here, let's make a group of oceanPolys. It's pretty simple: Any Polygon that isn't in the landPolys set // must be in the oceanPolys set instead. var oceanPolys = new PolySet(); foreach (Polygon poly in m_Polygons) { if (!landPolys.Contains(poly)) { oceanPolys.Add(poly); } } // Let's create the ocean surface as a separate mesh. // First, let's make a copy of the oceanPolys so we can // still use them to also make the ocean floor later. var oceanSurface = new PolySet(oceanPolys); sides = Inset(oceanSurface, 0.05f); sides.ApplyColor(colorOcean); sides.ApplyAmbientOcclusionTerm(1.0f, 0.0f); if (m_OceanMesh != null) { Destroy(m_OceanMesh); } m_OceanMesh = GenerateMesh("Ocean Surface", m_OceanMaterial); // Back to land for a while! We start by making it green. =) foreach (Polygon landPoly in landPolys) { landPoly.m_Color = colorGrass; } // The Extrude function will raise the land Polygons up out of the water. // It also generates a strip of new Polygons to connect the newly raised land // back down to the water level. We can color this vertical strip of land brown like dirt. sides = Extrude(landPolys, 0.05f); sides.ApplyColor(colorDirt); sides.ApplyAmbientOcclusionTerm(1.0f, 0.0f); // Grab additional polygons to generate hills, but only from the set of polygons that are land. PolySet hillPolys = landPolys.RemoveEdges(); sides = Inset(hillPolys, 0.03f); sides.ApplyColor(colorGrass); sides.ApplyAmbientOcclusionTerm(0.0f, 1.0f); sides = Extrude(hillPolys, 0.05f); sides.ApplyColor(colorDirt); //Hills have dark ambient occlusion on the bottom, and light on top. sides.ApplyAmbientOcclusionTerm(1.0f, 0.0f); // Time to return to the oceans. sides = Extrude(oceanPolys, -0.02f); sides.ApplyColor(colorOcean); sides.ApplyAmbientOcclusionTerm(0.0f, 1.0f); sides = Inset(oceanPolys, 0.02f); sides.ApplyColor(colorOcean); sides.ApplyAmbientOcclusionTerm(1.0f, 0.0f); var deepOceanPolys = oceanPolys.RemoveEdges(); sides = Extrude(deepOceanPolys, -0.05f); sides.ApplyColor(colorDeepOcean); deepOceanPolys.ApplyColor(colorDeepOcean); // Okay, we're done! Let's generate an actual game mesh for this planet. if (m_GroundMesh != null) { Destroy(m_GroundMesh); } m_GroundMesh = GenerateMesh("Ground Mesh", m_GroundMaterial); }
public async Task ShowColour(HueColour colour) { var command = CreateColourCommand(colour); SendCommandAsync(command); }
public async Task ShowColour(HueColour colour, List <int> indexes) { var command = CreateColourCommand(colour); SendCommandAsync(command, indexes); }