public static string GetColoredOrbLetter(OrbColor orbType) { int index = (int)orbType; string letterStr = ColorLetters[index]; return(letterStr); }
public static string GetColoredOrbName(OrbColor orbType) { int index = (int)orbType; string colorStr = ColorNames[index]; return(colorStr); }
private List <Orb> getOrbSequence() { List <Orb> orbs = new List <Orb>(); for (int i = rng.Next(200); i > 0; i--) { rng.Next(); } OrbColor color = (OrbColor)(rng.Next(0, 400) / 100); int count = 0; if (rng.Next(0, 600) >= 550) { count = rng.Next(1, 2); } else { count = rng.Next(1, 2); } while (count >= 0) { orbs.Add(new Orb(color)); count--; } return(orbs); }
public void TurnLightningOn(OrbColor color) { //Зажигаем var converner = new ColorByteConverter(); byte colorByte = converner.Color2Byte(color); TurnLightningOn(colorByte); }
public void Send(OrbColor color) { var colorByte = _converter.Color2Byte(color); var stream = _client.GetStream(); stream.WriteByte(colorByte); stream.Close(); }
public ProgressColorCounter(OrbColor progressColor, OrbColor successColor, TimeSpan buildTimeout) { _lastNotProgressColor = new ColorInfo(OrbColor.Red, DateTime.Now.AddSeconds(-5)); _progressColor = progressColor; _successColor = successColor; _curColor = new ColorInfo(progressColor, DateTime.Now); _builders = new BuilderInfos(this); _buildTimeout = buildTimeout; }
protected override void OnStart() { color = (OrbColor)GetDsgVar<byte>("UByte_1"); col.groundDepth = 0; SetShadow(true); shadow.size = 1; col.wallEnabled = true; col.groundLevel = -0.65f; gravity = -30; SetRule("Ground"); }
public void OrbDrop(OrbColor orbColor) { if (orbDropObjectColor.color != Color.white) { orbDropObjectInstantiation = Instantiate(orbDropObject, transform.position, Quaternion.identity); orbDropObjectInstantiation.GetComponent <Orbs>().orbColor = orbColor; orb.color = Color.white; orbDropObjectColor.color = Color.white; rGBViewer.SetLayer(ColorType.white); } }
public byte Color2Byte(OrbColor color) { if (!_colors.ContainsValue(color)) { return(0); } var pair = _colors.Single(x => x.Value == color); return(pair.Key); }
public void checkForConsecutives(int section, Orb o) { OrbColor color = o.Color; bool backSearching = true; int consecutives = 1; int consecutivesStart = 0; int i = sections[section].IndexOf(o) - 1; while (backSearching) { if (i < 0) { backSearching = false; break; } if (sections[section][i].Color.Equals(color)) { consecutives++; i--; } else { consecutivesStart = i + 1; backSearching = false; } } bool forwardSearching = true; i = sections[section].IndexOf(o) + 1; while (forwardSearching) { if (i >= sections[section].Count()) { forwardSearching = false; break; } if (sections[section][i].Color.Equals(color)) { consecutives++; i++; } else { forwardSearching = false; } } if (consecutives >= 3) { DestroyRange(section, consecutivesStart, consecutives); } }
private byte CalculateColorByteForOrb(ColorPacket colorPacket) { OrbColor receivedColor = _converter.Byte2Color(colorPacket.ColorByte); Console.WriteLine("{0} Recieved color {1} from sender {2}", DateTime.Now, receivedColor, colorPacket.SenderName); _colorCounter.ProcessColor(receivedColor, colorPacket.SenderName); var colorToSendToOrb = _colorCounter.GetCurrentColor(); var colorByteToSendToOrb = _converter.Color2Byte(colorToSendToOrb); return(colorByteToSendToOrb); }
IEnumerator Wait(OrbColor color) { Show(); GameObject newOrb = Instantiate(uiorb, GetComponent <RectTransform>()); newOrb.GetComponent <Image>().sprite = GetColorSprite(color); orbs.Add(newOrb); yield return(new WaitForSeconds(2)); Hide(); }
// Metodo que checa se a cor passada por parametro combina com a // cor dessa orbe, sendo cores exatamente iguals ou uma delas sendo multi // contanto que nenhuma delas tenha cor nula (Branca). bool checkMatch(OrbColor otherColor) { // Checando se as cores combinam if (orbColor == otherColor || orbColor == OrbColor.kColorMulti || otherColor == OrbColor.kColorMulti) { // Checando se nenhuma das orbes possui a cor nula if (orbColor != OrbColor.kColorNull && otherColor != OrbColor.kColorNull) { // Houve match return(true); } } // Nao houve match return(false); }
void GetOrbColor(OrbColor orb) { switch (orb) { case OrbColor.red: spriteRenderer.color = Color.red; break; case OrbColor.green: spriteRenderer.color = Color.green; break; case OrbColor.blue: spriteRenderer.color = Color.blue; break; } }
private Sprite GetColorSprite(OrbColor color) { if (color == OrbColor.Red) { return(sprite_red); } else if (color == OrbColor.Green) { return(sprite_green); } else if (color == OrbColor.Blue) { return(sprite_blue); } else { return(sprite_red); } }
private int getHoldColor(OrbColor color) { switch (color) { case OrbColor.RED: return((int)ConsoleColor.DarkRed); case OrbColor.BLUE: return((int)ConsoleColor.Blue); case OrbColor.WHITE: return((int)ConsoleColor.White); case OrbColor.BLACK: return((int)ConsoleColor.Black); default: return(0); } }
public byte Convert(OrbColor color) { switch (color) { case OrbColor.Red: return(1); case OrbColor.Green: return(2); case OrbColor.Blue: return(4); case OrbColor.Yellow: return(3); case OrbColor.White: return(7); } return(0); }
public void ProcessColor(OrbColor color, string sender) { BuilderInfo builderInfo = _builders.GetInfo(sender); if (color == _progressColor) { DateTime buildStartTime = DateTime.Now; builderInfo.ProgressQueue.Enqueue(buildStartTime); _curColor = new ColorInfo(color, buildStartTime); } else { DateTime expectedBuildStartedTime = builderInfo.GetFirstBuildTimeStarted(); if (_builders.OrdersCount > 0) { DateTime buidStarted = builderInfo.ProgressQueue.Dequeue(); if (color == _successColor) { _buildTimeout = CalcBuildTimeout(buidStarted); } DequeExpiredProgressColors(); } if (_builders.OrdersCount == 0) { if (expectedBuildStartedTime.Ticks >= _lastNotProgressColor.BuildStartTime.Ticks) { _curColor = new ColorInfo(color, expectedBuildStartedTime); } else { _curColor = _lastNotProgressColor; } } _lastNotProgressColor = new ColorInfo(color, expectedBuildStartedTime); } }
public ProgressColorCounter(OrbColor progressColor, OrbColor successColor) : this(progressColor, successColor, TimeSpan.FromHours(1)) { }
public void ProcessColor(OrbColor color, string sender) { _currentColor = color; }
public void AddOrb(OrbColor color) { StartCoroutine(Wait(color)); }
internal Orb(OrbColor color) { SetColor(color); }
internal void SetColor(OrbColor color) { this.Color = color; LoadSprite(); }
public ArgParser(string[] args) { if (args.Length == 0) { throw new ArgumentsParseException(ArgumentsUsage); } PortNumber = DefaultPortNumber; IsClientMode = false; IsLocalMode = true; ServerAddress = null; Color = OrbColor.None; CountProgressColors = false; ProgressColorForServer = OrbColor.Blue; SuccessColorForServer = OrbColor.Green; IsClientMode = !args.Any(x => x.StartsWith("/startServer:", true, CultureInfo.CurrentCulture)); if (IsClientMode) { string colorArg = args.FirstOrDefault(x => x.StartsWith("/color:", true, CultureInfo.CurrentCulture)); if (colorArg == null) { throw new ArgumentsParseException("You must specify color!"); } var colorArgParts = colorArg.Split(':'); string colorArgValue = colorArgParts[1]; OrbColor resultColor; if (OrbColor.TryParse(colorArgValue, true, out resultColor)) { Color = resultColor; } else { throw new ArgumentsParseException("You must specify color!"); } string ServerAddressArg = args.FirstOrDefault(x => x.StartsWith("/startClient:", true, CultureInfo.CurrentCulture)); if (ServerAddressArg != null) { ServerAddress = GetServerAddress(ServerAddressArg); IsLocalMode = false; } PortNumber = GetPort(args); } else { string serverAddressArg = args.FirstOrDefault(x => x.StartsWith("/startServer:", true, CultureInfo.CurrentCulture)); ServerAddress = GetServerAddress(serverAddressArg); PortNumber = GetPort(args); if (args.Any(x => x.StartsWith("/countProgessColors", true, CultureInfo.CurrentCulture))) { CountProgressColors = true; } //reading progress color string progressColorArg = args.FirstOrDefault(x => x.StartsWith("/progressColor:", true, CultureInfo.CurrentCulture)); if (progressColorArg != null) { string progressColorValue = progressColorArg.Split(':')[1]; OrbColor resultColor; if (OrbColor.TryParse(progressColorValue, true, out resultColor)) { ProgressColorForServer = resultColor; } } //reading success color string successColorArg = args.FirstOrDefault(x => x.StartsWith("/successColor:", true, CultureInfo.CurrentCulture)); if (successColorArg != null) { string successColorValue = successColorArg.Split(':')[1]; OrbColor resultColor; if (OrbColor.TryParse(successColorValue, true, out resultColor)) { SuccessColorForServer = resultColor; } } } }
public void setDetails(OrbColor orbcolor, float lifetime) { this.orbcolor = orbcolor; this.timeUntilDeath = lifetime; }
private void CurrentColorCheck(OrbColor expectedColor) { Assert.AreEqual(expectedColor, _counter.GetCurrentColor()); }
public ColorInfo(OrbColor color, DateTime buildStartTime) { Color = color; BuildStartTime = buildStartTime; }
public bool HasMatchingColor(OrbColor matchColor) { return(orbColor == matchColor); }
public void ProcessColor(OrbColor color) { ProcessColor(color, "UnknownSender"); }
public PuzzleOrb(int inX, int inY, OrbColor inOrbType) { index.x = inX; index.y = inY; orbColor = inOrbType; }