private MyShape lineToShape(string line) { MyShape shape = new MyShape(); String[] parts = line.Split(new char[] { ';' }, 6); if (parts.Length != 6) { throw new InvalidDataException("File format is wrong."); } int type = int.Parse(parts[0]); double x, y, dx, dy; x = Double.Parse(parts[1]); y = Double.Parse(parts[2]); dx = Double.Parse(parts[3]); dy = Double.Parse(parts[4]); COLORS color = (COLORS)int.Parse(parts[5]); shape.kind = type; shape.x = x; shape.y = y; shape.dx = dx; shape.dy = dy; shape.color = color; return(shape); }
public void TriggerSetPlatform(GameObject gameObject, COLORS platformColor) { if (setPlatformEvent != null) { setPlatformEvent(gameObject, platformColor); } }
public void TriggerPlatformColorEvent(COLORS playerColor) { if (PlatformColorEvent != null) { PlatformColorEvent(playerColor); } }
Dictionary <COLORS, int> GetColorWeights() { Dictionary <COLORS, int> color_weights = new Dictionary <COLORS, int>(); foreach (string coord in globals.reachable_moves.Keys) { // reachable and on screen but not occupied int comma_index = coord.IndexOf(','); int x_coord; int y_coord; int.TryParse(coord.Substring(comma_index + 1), out y_coord); int.TryParse(coord.Substring(0, comma_index), out x_coord); bool inbounds = x_coord >= 0 && x_coord < globals.BOARD_WIDTH && y_coord >= 0 && y_coord < globals.BOARD_HEIGHT; if (!globals.occupied_squares.ContainsKey(coord) && inbounds) { //print("game loaded" + globals.gameLoaded); //print("coord" + coord); print(globals.board_colors[coord]); COLORS color = globals.board_colors[coord]; if (!color_weights.ContainsKey(color)) { color_weights.Add(color, (int)Math.Pow(2.5, x_coord + 1)); } else { color_weights[color] += (int)Math.Pow(2.5, x_coord + 1); } } } return(color_weights); }
void Disable() { Dictionary <COLORS, int> color_weights = GetColorWeights(); if (current != null) { Destroy(current); current = null; } int maxWeight = 0; foreach (COLORS color in color_weights.Keys) { if (color_weights[color] > maxWeight) { maxWeight = color_weights[color]; } } foreach (COLORS color in color_weights.Keys) { if (color_weights[color] == maxWeight) { current_disabled = color; current = Instantiate(squares[color], curPosition, Quaternion.identity); break; } } if (globals.numPieces - globals.finishedPieces == globals.piece_color_counts[current_disabled]) { globals.gameLost = true; } }
public static string SetTextAttributes(ATTRS attribute, COLORS foregroundColor, COLORS backgroundColor) { return(ESC + String.Format("[{0};{1};{2}m", (int)attribute, (int)foregroundColor, (int)backgroundColor)); }
void CreateRandomRoutine() { routine = new COLORS[8]; for(int i = 0; i < routine.Length; i++) { routine[i] = (COLORS)Random.Range(0, 4); } }
void CreateRandomPattern() { pattern = new COLORS[patternLength]; for (int i = 0; i < pattern.Length; i++) { pattern[i] = (COLORS)Random.Range(0, 4); } }
public void UpdateData(BaseColor data) { mainColor = data.GetMain; if (!choices.ContainsKey(data.GetMain)) { Debug.Log(data.GetMain); } image.sprite = choices[data.GetMain]; }
public Car() { Random rand = new Random(); Mark = rand.RandomString(6); Model = rand.RandomString(6); Price = rand.Next(1_000, 15_001); COLORS color = (COLORS)rand.Next(1, 12); string[] tmp = color.ToString().Split('.'); Color = tmp[tmp.Length - 1]; }
private void SetPlatform(GameObject platform, COLORS platformColor) { if (platformColor != mainColor) { return; } if (platform == null) { collidedPlatform = null; return; } if (platform.GetComponent <ControllablePlatform>() != null) { collidedPlatform = platform.GetComponent <ControllablePlatform>(); } }
// This script will simply instantiate the Prefab when the game starts. //https://www.colorcombos.com/color-schemes/2/ColorCombo2.html void Start() { original_loc = gameObject.transform.position; if (gameObject.name.Contains("Blue")) { color = COLORS.BLUE; } else if (gameObject.name.Contains("Orange")) { color = COLORS.ORANGE; } else if (gameObject.name.Contains("Yellow")) { color = COLORS.YELLOW; } else if (gameObject.name.Contains("Green")) { color = COLORS.GREEN; } }
private void SetPlatform(GameObject platform, COLORS platformColor) { if (platformColor != mainColor) { return; } if (platform == null) { if (collidedPlatform != null) { collidedPlatform.Charging = false; } collidedPlatform = null; return; } if (platform.GetComponent <MovingPlatform>() != null) { collidedPlatform = platform.GetComponent <MovingPlatform>(); } }
//Rooms //Kitchen with absolutely nothing in it. //Pool room with a giant swimming pool. The pool is empty but theres water everywhere else //Wardrobe with lots and lots of hats. //Upside-down-house room where everything is upside dooooooooooooooooown //Tiny room with a hole that leads to the dungeon. //Introduce Player to the building and rooms public void ColoredGreet() { //Colors for later use const String COLORS = "Red,Blue,Pink,Gray,Purple,Aquamarine,Gold,Silver"; String ThirdColor; int CLocation; int CLength; //Select Third Color of String CLocation = COLORS.IndexOf(","); CLength = COLORS.Length - CLocation; ThirdColor = COLORS.Substring(CLocation + 1, CLength - 1); CLocation = ThirdColor.IndexOf(","); CLength = ThirdColor.Length - CLocation; ThirdColor = ThirdColor.Substring(CLocation + 1, CLength - 1); CLocation = ThirdColor.IndexOf(","); CLength = ThirdColor.Length - CLocation; ThirdColor = ThirdColor.Substring(0, CLocation); Console.WriteLine("You've found the key!"); Console.WriteLine("The door in front of you slides into the ground without you even using the key."); Console.WriteLine("You step through the doorway and are greeted by a floating, glowing " + ThirdColor + " ball. The ball then instantly disappears."); }
public static bool IsBipartite(this Graph g) { COLORS[] col = new COLORS[g.VerticesCount]; for (int i = 1; i < g.VerticesCount; i++) { col[i] = COLORS.NONE; } for (int i = 0; i < g.VerticesCount; i++) { if (col[i] == COLORS.NONE) { if (!BFSColoring(g, i, ref col)) { return(false); } } } return(true); // zmienic ! }
public static string SetForegroundColor(COLORS foregroundColor) { return ESC + String.Format("[{0}m", (int) foregroundColor); }
public static string SetForegroundColor(COLORS foregroundColor) { return(ESC + String.Format("[{0}m", (int)foregroundColor)); }
public static string SetBackgroundColor(COLORS backgroundColor) { return(ESC + String.Format("[{0}m", (int)backgroundColor)); }
public static Color GetColor(COLORS color) => Colors[(int)color];
public static Color GetColor(COLORS color) { return(Colors.ColorArray[(int)color]); }
private static void FlashColor(COLORS color, int flashes, FLASHSPEEDS speed) { int delayms; if (speed == FLASHSPEEDS.FAST) { delayms = 200; } else if (speed == FLASHSPEEDS.SLOW) { delayms = 800; } else { delayms = customdelay; } for (int i = 0; i < flashes; i++) { TurnOnLED(color); Thread.Sleep(delayms); TurnOffLED(color); if (speed == FLASHSPEEDS.CUSTOM) Thread.Sleep(delayms / 2); else Thread.Sleep(delayms); } }
private static void TurnOnLED(COLORS color) { switch (color) { case COLORS.BLUE: blueled.Write(false); break; case COLORS.RED: redled.Write(false); break; case COLORS.GREEN: greenled.Write(false); break; case COLORS.WHITE: blueled.Write(false); greenled.Write(false); redled.Write(false); break; } }
public static string SetTextAttributes(COLORS foregroundColor, COLORS backgroundColor) { return ESC + String.Format("[{0};{1}m", (int) foregroundColor, (int) backgroundColor); }
public static string SetBackgroundColor(COLORS backgroundColor) { return ESC + String.Format("[{0}m", (int) backgroundColor); }