private void ChangeConnectionColor(Dot.DotColor dotColor, ref GameObject connection) { Image image = connection.GetComponent <Image>(); switch (dotColor) { case Dot.DotColor.Red: image.color = Color.red; break; case Dot.DotColor.Blue: image.color = Color.blue; break; case Dot.DotColor.Yellow: image.color = Color.yellow; break; case Dot.DotColor.Green: image.color = Color.green; break; case Dot.DotColor.Purple: image.color = Color.magenta; break; default: image.color = Color.white; break; } }
public void RandomizeColor(ref Dot toColor, Dot.DotColor colorRestriction = Dot.DotColor.Blank) { int min = 1; int max = (int)Dot.DotColor.NumColors; //Will continue rolling colors till a non-restricted color is found do { toColor.CurrentColor = (Dot.DotColor)Random.Range(min, max); } while (toColor.CurrentColor == colorRestriction); }
public GameObject ConnectionFromPool(Dot.DotColor dotColor) { GameObject toReturn; //Returns a Connection from the pool if one exists otherwise adds creates a new Connection if (mConnectionPool.Count > 0) { toReturn = mConnectionPool[0]; mConnectionPool.RemoveAt(0); } else { toReturn = ProduceConnection(); Debug.LogWarning("Not enough Connections were originally created"); } ChangeConnectionColor(dotColor, ref toReturn); return(toReturn); }