static void Main(string[] args) { Console.WriteLine("Выберите цвета которые будут помещен в избранную политру:"); colors[] colors = new colors[4]; for(int i =0; i<4;i++) { while (true) { object color; Console.WriteLine("Выберите цвет:"); if (Enum.TryParse(typeof(colors), Console.ReadLine(), true, out color)) { colors[i] = (colors)color; Console.WriteLine(colors[i]); break; } else { Console.WriteLine("Ошибка"); } } } if () }
static void Main(string[] args) { colors allColors = colors.zero; var colorsGetNames = Enum.GetNames(typeof(colors)); for (var i = 0; i < (colorsGetNames.Length - 1); i++) { allColors |= (colors)(1 << i); } Console.WriteLine("Here are all colors. Please, choose 4 colors to add they to favorites."); for (int i = 1; i < colorsGetNames.Length; i++) { Console.WriteLine(colorsGetNames[i]); } colors favoriteColors = colors.zero; for (int i = 0; i < 4; i++) { Console.Write("Enter the color: "); var color = (colors)Enum.Parse(typeof(colors), Console.ReadLine()); favoriteColors |= color; } Console.WriteLine("Your favorite colors are: " + favoriteColors); Console.WriteLine("Rest colors are: " + (favoriteColors ^ allColors)); }
bool isCastelingLegal(ChessBoard board, Location tryToMoveTo) { if (!check) { bool isLegalCastelCol = (tryToMoveTo.Col == CurrentLocation.Col + 2 || tryToMoveTo.Col == CurrentLocation.Col - 2); if (isLegalRow(tryToMoveTo.Row) && isLegalCastelCol) { colors enemyColor = getEnemyColor(); int colMovment = tryToMoveTo.Col > CurrentLocation.Col ? 1 : -1; Location rookWillMoveHere = new Location(CurrentLocation.Row, CurrentLocation.Col + colMovment); bool rookLocationLegal = (!board.isOccupied(rookWillMoveHere) && !canThisLocationBeCapture(board, rookWillMoveHere, enemyColor)); bool moveingLocationLegal = (!board.isOccupied(tryToMoveTo) && !canThisLocationBeCapture(board, tryToMoveTo, enemyColor)); if (rookLocationLegal && moveingLocationLegal) { int rooksCol = tryToMoveTo.Col > CurrentLocation.Col ? 7 : 0; Location rooksLocation = new Location(CurrentLocation.Row, rooksCol); Rook castelRook = board[rooksLocation] as Rook; if (castelRook != null && !castelRook.hasDoneFirstMove) { board.castelingAvailable = true; return(true); } } } } return(false); }
public car(int difYear, String difMake, string difModel, colors difColor) { year = difYear; make = difMake; model = difModel; Colors = difColor; }
/// <summary> /// Gets color from settings as a brush /// </summary> /// <param name="type">Color type to set</param> /// <param name="variant">Set day or night variant. Default is day</param> /// <returns>SolidColorBrush, color of color type per variant</returns> public SolidColorBrush getBrush(colors type, string variant = "day") { SolidColorBrush bru = null; switch (type) { case colors.Day: bru = colorToBrush(variant == "day" ? _mySettings.c_day_Day : _mySettings.c_night_Day); break; case colors.DayText: bru = colorToBrush(variant == "day" ? _mySettings.c_day_DayText : _mySettings.c_night_DayText); break; case colors.MainBackground: bru = colorToBrush(variant == "day" ? _mySettings.c_day_MainBackground : _mySettings.c_night_MainBackground); break; case colors.SelectedDay: bru = colorToBrush(variant == "day" ? _mySettings.c_day_SelectedDay : _mySettings.c_night_SelectedDay); break; case colors.Sunday: bru = colorToBrush(variant == "day" ? _mySettings.c_day_Sunday : _mySettings.c_night_Sunday); break; case colors.Text: bru = colorToBrush(variant == "day" ? _mySettings.c_day_Text : _mySettings.c_night_Text); break; case colors.TextboxBackground: bru = colorToBrush(variant == "day" ? _mySettings.c_day_TextboxBackground : _mySettings.c_night_TextboxBackground); break; case colors.TextSelection: bru = colorToBrush(variant == "day" ? _mySettings.c_day_TextSelection : _mySettings.c_night_TextSelection); break; } return(bru); }
// Update is called once per frame void Update() { print("And did I update once ?"); LogitechGSDK.LogiLedSetLighting(red, green, blue); print("And did I update a second time ?"); if (Input.GetKey(KeyCode.R)) { curr_color = colors.R; } else if (Input.GetKey(KeyCode.G)) { curr_color = colors.G; } else if (Input.GetKey(KeyCode.B)) { curr_color = colors.B; } else if (Input.GetKey(KeyCode.KeypadPlus)) { switch (curr_color) { case colors.R: goal_r = Mathf.Min((float)(goal_r + 0.02f), 1.0f); red = (int)Mathf.Min((float)(red + 2), 100.0f); break; case colors.G: goal_g = Mathf.Min((float)(goal_g + 0.02f), 1.0f); green = (int)Mathf.Min((float)(green + 2), 100.0f); break; case colors.B: goal_b = Mathf.Min((float)(goal_b + 0.02f), 1.0f); blue = (int)Mathf.Min((float)(blue + 2), 100.0f); break; } } else if (Input.GetKey(KeyCode.KeypadMinus)) { switch (curr_color) { case colors.R: goal_r = Mathf.Max((float)(goal_r - 0.02f), 0.0f); red = (int)Mathf.Max((float)(red - 2), 0.0f); break; case colors.G: goal_g = Mathf.Max((float)(goal_g - 0.02f), 0.0f); green = (int)Mathf.Max((float)(green - 2), 0.0f); break; case colors.B: goal_b = Mathf.Max((float)(goal_b - 0.02f), 0.0f); blue = (int)Mathf.Max((float)(blue - 2), 0.0f); break; } } }
// 2nd overload constructor that allows you to set Year Make Model and Color public car(int otherYear, string otherMake, string otherModel, colors C) { this.year = otherYear; this.make = otherMake; this.model = otherModel; this.CarColors = C; }
// Update is called once per frame void Update() { colors_holder_script = colors_holder.GetComponent <colors>(); this.r = colors_holder_script.r; this.g = colors_holder_script.g; this.b = colors_holder_script.b; this.a = colors_holder_script.a; if (is_particlesystem) { // ps = this.GetComponent<ParticleSystem>(); // ps.particleSystem.startColor = new Color(r / 255, g / 255, b / 255, a / 255); // this.particleSystem.startColor = new Color(r / 255, g / 255, b / 255, a / 255); //this.GetComponent<ParticleSystem>().particleSystem.startColor = new Color(r / 255, g / 255, b / 255, a / 255); this.GetComponent <UnityEngine.ParticleSystem>().startColor = new Color(r / 255, g / 255, b / 255, a / 255); } else if (is_light) { this.GetComponent <Light>().color = new Color(r / 255, g / 255, b / 255, a / 255); } else { this.GetComponent <Renderer>().material.SetColor("_Color", new Color(r / 255, g / 255, b / 255, a / 255)); } }
private static ConsoleColor idenityToActualColor(colors id) { /*Switchcase allows us to go from the enum colors to actuall ConsoleColors, which allows us to change fore * and background colors for the text.*/ switch (id) { case colors.black: return(ConsoleColor.Black); case colors.blue: return(ConsoleColor.Blue); case colors.cyan: return(ConsoleColor.Cyan); case colors.darkBlue: return(ConsoleColor.DarkBlue); case colors.darkCyan: return(ConsoleColor.DarkCyan); case colors.darkGray: return(ConsoleColor.DarkGray); case colors.darkGreen: return(ConsoleColor.DarkGreen); case colors.darkMagenta: return(ConsoleColor.DarkMagenta); case colors.darkRed: return(ConsoleColor.DarkRed); case colors.darkYellow: return(ConsoleColor.DarkYellow); case colors.gray: return(ConsoleColor.Gray); case colors.green: return(ConsoleColor.Green); case colors.magenta: return(ConsoleColor.Magenta); case colors.red: return(ConsoleColor.Red); case colors.white: return(ConsoleColor.White); case colors.yellow: return(ConsoleColor.Yellow); } throw new Exception("Color is not Valid"); return(ConsoleColor.White); }
private bool putChar(char c, colors color, string fontname) { int retVal = 0; if (c == '\n') { x = 0; y += 8; return(true); } else if (c == ' ') { x += 3; return(true); } switch (c) { case 'ü': putChar('u', color, fontname); c = 'e'; break; case 'Ü': putChar('U', color, fontname); c = 'e'; break; case 'ä': putChar('a', color, fontname); c = 'e'; break; case 'Ä': putChar('A', color, fontname); c = 'e'; break; case 'ö': putChar('o', color, fontname); c = 'e'; break; case 'Ö': putChar('O', color, fontname); c = 'e'; break; case 'ß': putChar('s', color, fontname); c = 's'; break; } if (color == colors.red) { retVal = font.putChar(ref led_columns_red, ref x, ref y, c, fontname); } else if (color == colors.green) { retVal = font.putChar(ref led_columns_green, ref x, ref y, c, fontname); } else if (color == colors.amber) { retVal = font.putChar(ref led_columns_red, ref x, ref y, c, fontname); retVal = font.putChar(ref led_columns_green, ref x, ref y, c, fontname); } if (retVal == 0) { return(false); } x += retVal + 1; return(true); }
// Update is called once per frame void Update() { LogitechGSDK.LogiLedSetLighting(red, blue, green); if (Input.GetKeyDown(KeyCode.R)) { curr_color = colors.R; } if (Input.GetKeyDown(KeyCode.G)) { curr_color = colors.G; } if (Input.GetKeyDown(KeyCode.B)) { curr_color = colors.B; } if (Input.GetKeyDown(KeyCode.KeypadPlus)) { switch (curr_color) { case colors.R: red = (int)Mathf.Min((float)(red + 5), 100.0f); break; case colors.G: green = (int)Mathf.Min((float)(green + 5), 100.0f); break; case colors.B: blue = (int)Mathf.Min((float)(blue + 5), 100.0f); break; } } if (Input.GetKeyDown(KeyCode.KeypadMinus)) { switch (curr_color) { case colors.R: red = (int)Mathf.Max((float)(red - 5), 0.0f); break; case colors.G: green = (int)Mathf.Max((float)(green - 5), 0.0f); break; case colors.B: blue = (int)Mathf.Max((float)(blue - 5), 0.0f); break; } } }
static void Main(string[] args) { colors clr = colors.Green; Console.WriteLine(clr); colors clr2 = colors.Blue; Console.WriteLine(clr2); int red = (int)colors.Red; Console.WriteLine(red); Console.ReadLine(); }
public virtual void Move(ChessBoard board, Location tryToMoveTo) { colors enemyColor = getEnemyColor(); King myKing = Color == colors.BLACK ? board.blackKing : board.whiteKing; if (isLegalMovmentAndNotOnKing(board, tryToMoveTo) && !willThisMoveCheckTheKing(board, CurrentLocation, tryToMoveTo, enemyColor)) { King enemyKing = Color == colors.BLACK ? board.whiteKing : board.blackKing; bool fiftyMoveRuleLegalinEffect = board.isfiftyMoveRuleLegal(this, tryToMoveTo); if (board.castelingAvailable) { int rooksCol = tryToMoveTo.Col > CurrentLocation.Col ? 7 : 0; int rookColMovement = tryToMoveTo.Col > CurrentLocation.Col ? 5 : 3; Location rooksLocation = new Location(CurrentLocation.Row, rooksCol); Rook castelRook = board[rooksLocation] as Rook; castelRook.successfulMovment(board, new Location(CurrentLocation.Row, rookColMovement)); board.castelingAvailable = false; } successfulMovment(board, tryToMoveTo); if (fiftyMoveRuleLegalinEffect) { throw new FiftyMovesException(); } board.addRecordOrEndTheGame(); myKing.check = false; //if movment was succeful, then my king can't be in check. if (canThisLocationBeCapture(board, enemyKing.CurrentLocation, Color)) { enemyKing.check = true; } if (enemyKing.check) { if (!canAnyMovePreventCheck(board, enemyColor)) { throw new CheckmateException(); } } enPassantCancelation(board); } else if (!myKing.check && anyMoveWillResultInCheck(board, Color)) { throw new StalemateException(); } else { throw new IlleagalMoveException(); } }
static void Main(string[] args) { // рассчитываем переменную со всеми возможными цветами colors allColors = 0; foreach (colors singleColor in Enum.GetValues(typeof(colors))) { allColors = allColors | singleColor; } // выводим возможные цвета за исключением "нулевого" Console.WriteLine("Список возможных цветов:"); Console.WriteLine(allColors); // здесь будем хранить любимые цвета colors favoriteColors = 0; // прочитаем их for (int i = 0; i < 4; i++) { Console.Write($"Введите любимый цвет {i + 1}: "); object color = Enum.Parse(typeof(colors), Console.ReadLine()); favoriteColors |= (colors)color; } // выводим любимые цвета Console.WriteLine("Любимые цвета:"); Console.WriteLine(favoriteColors); Console.WriteLine(); // рассчитываем нелюбимые цвета черех allColors XOR favoriteColors. colors notFavoriteColors = allColors ^ favoriteColors; // можно также инвертировать favoriteColors, // а потом "просеять" через AND с allColors. //colors notFavoriteColors = ~favoriteColors; //notFavoriteColors = (colors)(((int)notFavoriteColors << 23) >> 23 ); Console.WriteLine("Нелюбимые цвета:"); Console.WriteLine(notFavoriteColors); Console.WriteLine(); Console.WriteLine("\nОтладочная информация:"); WriteInt32ValueWithBits(allColors, nameof(allColors)); WriteInt32ValueWithBits(favoriteColors, nameof(favoriteColors)); WriteInt32ValueWithBits(notFavoriteColors, nameof(notFavoriteColors)); }
private void putBar(colors color) { if (color == colors.red) { led_columns_red[x] = 65535; } else if (color == colors.green) { led_columns_green[x] = 65535; } else { led_columns_red[x] = 65535; led_columns_green[x] = 65535; } x++; }
/// <summary> /// Set the colors in the settings for each type both day and night coloration /// </summary> /// <param name="c">Color to set</param> /// <param name="type">Color type to set</param> /// <param name="variant">Set day or night variant. Default is day</param> public void setColor(System.Drawing.Color c, colors type, string variant = "day") { if (variant == "day") { switch (type) { case colors.Day: _mySettings.c_day_Day = c; break; case colors.DayText: _mySettings.c_day_DayText = c; break; case colors.MainBackground: _mySettings.c_day_MainBackground = c; break; case colors.SelectedDay: _mySettings.c_day_SelectedDay = c; break; case colors.Sunday: _mySettings.c_day_Sunday = c; break; case colors.Text: _mySettings.c_day_Text = c; break; case colors.TextboxBackground: _mySettings.c_day_TextboxBackground = c; break; case colors.TextSelection: _mySettings.c_day_TextSelection = c; break; } } else { switch (type) { case colors.Day: _mySettings.c_night_Day = c; break; case colors.DayText: _mySettings.c_night_DayText = c; break; case colors.MainBackground: _mySettings.c_night_MainBackground = c; break; case colors.SelectedDay: _mySettings.c_night_SelectedDay = c; break; case colors.Sunday: _mySettings.c_night_Sunday = c; break; case colors.Text: _mySettings.c_night_Text = c; break; case colors.TextboxBackground: _mySettings.c_night_TextboxBackground = c; break; case colors.TextSelection: _mySettings.c_night_TextSelection = c; break; } } }
public void SetColor(Chameleon c) { if (this.Color != c.Color) { switch (this.Color) { case colors.Black: if (c.Color == colors.Brown) { this.Color = colors.Gray; } else { this.Color = colors.Brown; } break; case colors.Brown: if (c.Color == colors.Black) { this.Color = colors.Gray; } else { this.Color = colors.Black; } break; case colors.Gray: if (c.Color == colors.Black) { this.Color = colors.Brown; } else { this.Color = colors.Black; } break; default: break; } } }
bool canAnyMovePreventCheck(ChessBoard board, colors enemyColor) //checking this for the enemy, if the enemy king is checked, were gonna call this function { List <ChessPiece> enemyList = enemyColor == colors.BLACK ? board.blacksAlive : board.whitesAlive; foreach (ChessPiece piece in enemyList) { for (int row = 0; row < ChessBoard.SIZE; row++) { for (int col = 0; col < ChessBoard.SIZE; col++) { if (willThisMovePreventCheck(board, piece.CurrentLocation, new Location(row, col), Color)) { return(true); } } } } return(false); }
bool anyMoveWillResultInCheck(ChessBoard board, colors myColor) { List <ChessPiece> myList = Color == colors.WHITE ? board.whitesAlive : board.blacksAlive; foreach (ChessPiece piece in myList) { for (int row = 0; row < ChessBoard.SIZE; row++) { for (int col = 0; col < ChessBoard.SIZE; col++) { if (!willThisMoveCheckTheKing(board, piece.CurrentLocation, new Location(row, col), getEnemyColor())) { return(false); } } } } return(true); }
static void Main(string[] args) { var colorPallet = colors.Black | colors.White | colors.Cyan | colors.Blue | colors.Green | colors.Red | colors.Yellow | colors.Magenta | colors.Gray | colors.Brown | colors.Violet | colors.Crimson; var allColors = (colors[])Enum.GetValues(typeof(colors)); Console.WriteLine($"Список доступных цветов:"); for (var i = 1; i < allColors.Length; i++) { Console.WriteLine($"{i} - {allColors[i]}"); } colors favouriteColors = colors.None; colors unfavouriteColors = colors.None; for (var i = 1; i <= 4; i++) { Console.WriteLine($"\nВведите цвет номер {i}"); string input = Console.ReadLine(); colors inputParsed = (colors)Enum.Parse(typeof(colors), input); favouriteColors |= inputParsed; //студия меня поправила, сделав вот это. Я в целом не против, но на мой взгляд это читается хуже. } unfavouriteColors = favouriteColors ^ colorPallet; Console.WriteLine($"Ваши любимы цвета: {favouriteColors} "); Console.WriteLine($"Ваши нелюбимые цвета: {unfavouriteColors} "); }
protected void initColor() { GameObject froggy = this.transform.Find("Froggy").transform.Find("Frogbody").gameObject; Renderer frogRenderer = froggy.GetComponent <Renderer>(); float randColors = (Random.Range(0.0f, 100.0f)); if (randColors <= 40f) { this.colors = colors.GREEN; pointPotential = 2.5f; frogRenderer.material = greenMat; } else if (randColors <= 65f) { this.colors = colors.YELLOW; pointPotential = 4f; frogRenderer.material = yellowMat; } else if (randColors <= 82f) { this.colors = colors.BLUE; pointPotential = 6f; frogRenderer.material = blueMat; } else if (randColors <= 92f) { this.colors = colors.RED; pointPotential = 10f; frogRenderer.material = redMat; } else if (randColors <= 100f) { this.colors = colors.RAINBOW; pointPotential = 12.5f; frogRenderer.material = gayMat; } }
static void Main() //入口方法 { colors c = colors.red; //定义枚举结构对象 switch (c) //使用switch进行判断 { case colors.red: //如果c为color.red则输出“红色” System.Console.WriteLine("红色"); break; case colors.green: //如果c为color.red则输出“红色” System.Console.WriteLine("绿色"); break; case colors.blue: //如果c为color.red则输出“红色” System.Console.WriteLine("蓝色"); break; default: break; } //等待回车继续 System.Console.ReadLine(); }
internal Rook(colors color, pieceType piece, Location location) : base(color, pieceType.ROOK, location) { }
// Update is called once per frame void Update() { if (game_manager.gstate == vars.game_state.playing) { if (color_timer > 0.0f) { color_timer -= Time.deltaTime; } else { color_timer = color_timer_max; if (color_counter >= 5) { color_counter = 0; } else{ color_counter++; } switch (color_counter) { case 0: goal_color = colors.neutral; break; case 1: goal_color = colors.p1c; break; case 2: goal_color = colors.p2c; break; case 3: goal_color = colors.neutral; break; case 4: goal_color = colors.p3c; break; case 5: goal_color = colors.p4c; break; default: break; } update_color(); } if (!in_pp) { if (!ps.isPlaying) { explosion_holder.transform.position = pp; in_pp = true; } } } }
//---------------------------------------------------------------// //---------------------------------------------------------------// //-----------------------Color management-----------------------// //--------------------------------------------------------------// //getter and overloaded setter for the color of the bubble, //if you need to change it post creation for whatever reason public void setColor(int x) { color = (colors) x; }
// Use this for initialization void Start() { goal_color = colors.neutral; update_color(); color_counter = 5; hut_animator = hut_anim_holder.GetComponent<Animator>(); pumking_animator = pumkin_anim_holder.GetComponent<Animator>(); pp = GameObject.Find("pause_position").transform.position; ps = explosion_holder.GetComponent<ParticleSystem>(); asource = this.GetComponent<AudioSource>(); }
protected ChessPiece(colors color, pieceType piece, Location location) { Color = color; PieceType = piece; CurrentLocation = location; }
internal bool canThisLocationBeCapture(ChessBoard board, Location tryToMoveTo, colors captureingSideColor) //gonna be used to check if a move checks our king, and also to try and check the enemy's king { List <ChessPiece> captureingList = captureingSideColor == colors.WHITE ? board.whitesAlive : board.blacksAlive; foreach (ChessPiece piece in captureingList) { if (piece is Pawn) //simulate a situtation only for pawn captureing a piece { Pawn pawn = piece.Clone() as Pawn; pawn.hasDoneFirstMove = true; bool legalColForCapture = (tryToMoveTo.Col == pawn.CurrentLocation.Col - 1 || tryToMoveTo.Col == pawn.CurrentLocation.Col + 1); if (pawn.isLegalRow(tryToMoveTo.Row) && legalColForCapture) { return(true); } } else if (piece.isLegal(board, tryToMoveTo)) { return(true); } } return(false); }
bool willThisMoveCheckTheKing(ChessBoard board, Location currentMoveingPieceLocation, Location tryToMoveTo, colors captureingSideColor) //use this function after we validate the piece can move to a location according to its legal movment { ChessBoard testBoard = board.Clone() as ChessBoard; ChessPiece piece = testBoard[currentMoveingPieceLocation]; King testMyKing = captureingSideColor == colors.BLACK ? testBoard.whiteKing : testBoard.blackKing; testMyKing.check = false; if (piece.isLegalMovmentAndNotOnKing(testBoard, tryToMoveTo)) { piece.successfulMovment(testBoard, tryToMoveTo); if (piece is King) { testMyKing.CurrentLocation = tryToMoveTo; } return(canThisLocationBeCapture(testBoard, testMyKing.CurrentLocation, captureingSideColor)); } return(true); }
bool willThisMovePreventCheck(ChessBoard board, Location currentMoveingPieceLocation, Location tryToMoveTo, colors captureingSideColor) { ChessBoard testBoard = board.Clone() as ChessBoard; ChessPiece piece = testBoard[currentMoveingPieceLocation]; King testMyKing = captureingSideColor == colors.BLACK ? testBoard.whiteKing: testBoard.blackKing; testMyKing.check = false; if (piece.isLegalMovmentAndNotOnKing(testBoard, tryToMoveTo)) { piece.successfulMovment(testBoard, tryToMoveTo); if (piece is King) { testMyKing.CurrentLocation = tryToMoveTo; } return(!canThisLocationBeCapture(testBoard, testMyKing.CurrentLocation, captureingSideColor)); //if the king's location can be captured then we did not prevent check } return(false); }
// Use this for initialization void Start() { colors_holder_script = colors_holder.GetComponent <colors>(); }
private bool putChar(char c, colors color, string fontname) { int retVal = 0; if(c == '\n') { x = 0; y += 8; return true; } else if(c == ' ') { x += 3; return true; } switch(c) { case 'ü': putChar('u',color,fontname); c = 'e'; break; case 'Ü': putChar('U',color,fontname); c = 'e'; break; case 'ä': putChar('a',color,fontname); c = 'e'; break; case 'Ä': putChar('A',color,fontname); c = 'e'; break; case 'ö': putChar('o',color,fontname); c = 'e'; break; case 'Ö': putChar('O',color,fontname); c = 'e'; break; case 'ß': putChar('s',color,fontname); c = 's'; break; } if(color == colors.red) retVal = font.putChar(ref led_columns_red, ref x, ref y, c, fontname); else if(color == colors.green) retVal = font.putChar(ref led_columns_green, ref x, ref y, c, fontname); else if(color == colors.amber) { retVal = font.putChar(ref led_columns_red, ref x, ref y, c, fontname); retVal = font.putChar(ref led_columns_green, ref x, ref y, c, fontname); } if(retVal == 0) return false; x += retVal+1; return true; }
void Update() { //Make bubbles move forward GetComponent<Rigidbody>().velocity = transform.forward * speed * GameController.multiplier; //Change material if color changed if(color != prevColor){ prevColor = color; GetComponent<Renderer>().material = bMat[(int)color]; } //Set animator if bubble is rainbow if(color == colors.RAINBOW){ //Create animator if there isn't one if(GetComponent<Animator>() == null){ animator = this.gameObject.AddComponent<Animator>(); }else{ animator = this.gameObject.GetComponent<Animator>(); } //Apply color changing animation animator.runtimeAnimatorController = rAni; } }
internal Queen(colors color, pieceType piece, Location location) : base(color, pieceType.QUEEN, location) { }
void assingRow(int row, int col) { colors color = row == 0 ? colors.BLACK : colors.WHITE; Location settingLocation = new Location(); List <ChessPiece> alivesList = row == 0 ? blacksAlive : whitesAlive; switch (col) { case 0: settingLocation = new Location(row, col); boardState[row, col] = new Tile(new Rook(color, pieceType.ROOK, settingLocation)); alivesList.Add(this[settingLocation]); break; case 7: settingLocation = new Location(row, col); boardState[row, col] = new Tile(new Rook(color, pieceType.ROOK, settingLocation)); alivesList.Add(this[settingLocation]); break; case 1: settingLocation = new Location(row, col); boardState[row, col] = new Tile(new Knight(color, pieceType.KNIGHT, settingLocation)); alivesList.Add(this[settingLocation]); break; case 6: settingLocation = new Location(row, col); boardState[row, col] = new Tile(new Knight(color, pieceType.KNIGHT, settingLocation)); alivesList.Add(this[settingLocation]); break; case 2: settingLocation = new Location(row, col); boardState[row, col] = new Tile(new Bishop(color, pieceType.BISHOP, settingLocation)); alivesList.Add(this[settingLocation]); break; case 5: settingLocation = new Location(row, col); boardState[row, col] = new Tile(new Bishop(color, pieceType.BISHOP, settingLocation)); alivesList.Add(this[settingLocation]); break; case 4: if (row == 0) { settingLocation = new Location(row, col); boardState[row, col] = new Tile(new King(color, pieceType.KING, settingLocation)); blackKing = this[settingLocation] as King; } else { settingLocation = new Location(row, col); boardState[row, col] = new Tile(new King(color, pieceType.QUEEN, settingLocation)); whiteKing = this[settingLocation] as King; } alivesList.Add(this[settingLocation]); break; case 3: settingLocation = new Location(row, col); boardState[row, col] = new Tile(new Queen(color, pieceType.QUEEN, settingLocation)); alivesList.Add(this[settingLocation]); break; } col++; }
private void putBar(colors color) { if(color == colors.red) led_columns_red[x] = 65535; else if(color == colors.green) led_columns_green[x] = 65535; else { led_columns_red[x] = 65535; led_columns_green[x] = 65535; } x++; }