public void ApplyTheStyle(PossibleColors prim, PossibleColors sec, PossibleColors terc) { primaryColor = prim; secondaryColor = sec; terceryColor = terc; socks = GetComponentsInChildren <Image>(); for (int i = 0; i < socks.Length; i++) { Color32 color; if (socks[i].tag == "toes") { color = SockColor.GetColorCode(prim); socks[i].color = color; } if (socks[i].tag == "collar") { color = SockColor.GetColorCode(terc); socks[i].color = color; } if (socks[i].tag == "fold") { color = SockColor.GetColorCode(sec); socks[i].color = color; } } }
void Create (int range) { //int direction = GetMinDirection (range); int direction = Random.Range (0, 4); Vector2 vector = new Vector2 (range, range); if (direction == 1 || direction == 3) { vector.y = Random.Range (0, 18); } else { vector.x = Random.Range (0, 34); } //Debug.Log ("got vector : " + vector); if (IsAlreadyHere (vector)) return; alreadyHere.Enqueue (vector); GameObject guy = Instantiate (prefab) as GameObject; Vector2 pos = ComputePosition ((int)vector.x, (int)vector.y, direction, range % 2); //pos.y = 0.1f + ((5.0f - range) / 10.0f); guy.transform.parent = transform; guy.transform.localPosition = pos; float sc = Random.Range (0.75f, 1.2f); guy.transform.localScale *= sc; guy.renderer.materials [0].color = PossibleColors.GetRandom (); Stare t = guy.AddComponent<Stare> (); t.target = puck; ranges [direction, range]++; }
public bool CheckHit(PossibleColors color) { PhysicalStaff staffToHit = m_PhysicalStaves[m_VisualStaves[0].PhysicalStaffIndex]; if (staffToHit.Destroyed) { return(false); } else { Sound.Sounds.PlayToendeRamt(); if (staffToHit.Color == color) { staffToHit.Destroyed = true; return(true); } return(false); } }
public static Color ConvertColor(PossibleColors color) { switch (color) { case PossibleColors.Blue: return(Color.Blue); case PossibleColors.Red: return(Color.Red); case PossibleColors.Yellow: return(Color.Yellow); case PossibleColors.Green: return(Color.Green); default: throw new ArgumentException("Cannot convert this color"); } }
public static Color32 GetColorCode(PossibleColors color) { switch (color) { case PossibleColors.Red: return(new Color32(130, 13, 20, 255)); case PossibleColors.Blue: return(new Color32(9, 10, 183, 255)); case PossibleColors.Yellow: return(new Color32(255, 234, 0, 255)); case PossibleColors.Purple: return(new Color32(98, 0, 185, 255)); case PossibleColors.Orange: return(new Color32(233, 98, 0, 255)); case PossibleColors.Green: return(new Color32(0, 140, 18, 255)); case PossibleColors.Black: return(new Color32(0, 0, 0, 255)); case PossibleColors.Gray: return(new Color32(72, 72, 72, 255)); case PossibleColors.Pink: return(new Color32(173, 0, 149, 255)); case PossibleColors.White: default: return(new Color32(255, 255, 255, 255)); } }
static public PossibleColors mixColor(PossibleColors first, PossibleColors second) { switch (first) { case PossibleColors.Red: switch (second) { case PossibleColors.Blue: return(PossibleColors.Purple); case PossibleColors.Yellow: return(PossibleColors.Orange); case PossibleColors.White: return(PossibleColors.Pink); default: break; } break; case PossibleColors.Blue: switch (second) { case PossibleColors.Red: return(PossibleColors.Purple); case PossibleColors.Yellow: return(PossibleColors.Green); default: break; } break; case PossibleColors.Yellow: switch (second) { case PossibleColors.Red: return(PossibleColors.Orange); case PossibleColors.Blue: return(PossibleColors.Green); default: break; } break; case PossibleColors.White: switch (second) { case PossibleColors.Red: return(PossibleColors.Pink); case PossibleColors.Black: return(PossibleColors.Gray); default: break; } break; case PossibleColors.Black: if (second == PossibleColors.White) { return(PossibleColors.Gray); } break; } return(Random.Range(0, 1) == 1 ? first : second); }
private Color?GenerateRandomColor() { int randomKey = new System.Random().Next(0, PossibleColors.colorDict.Count); return(PossibleColors.GetColor(( ColorNames )randomKey)); }
public void Breed() { PossibleColors[] mColors = male.GetComponentInChildren <VanGogh>()?.GetArray(); PossibleColors[] fColors = female.GetComponentInChildren <VanGogh>()?.GetArray(); if (mColors == null || fColors == null) { return; } PossibleColors[] child = new PossibleColors[3]; switch (Random.Range(0, 3))//primary { case 0: child[0] = fColors[0]; break; case 1: child[0] = SockColor.mixColor(fColors[0], mColors[0]); break; default: child[0] = mColors[0]; break; } switch (Random.Range(0, 3))//secondary { case 0: child[1] = mColors[1]; break; case 1: child[1] = SockColor.mixColor(fColors[1], mColors[1]); break; default: child[1] = fColors[1]; break; } switch (Random.Range(0, 3))//tiercary { case 0: child[2] = fColors[2]; break; case 1: child[2] = mColors[2]; break; default: child[2] = SockColor.mixColor(fColors[2], mColors[2]); break; } GameObject.FindGameObjectWithTag("Player").GetComponent <CameraTest>().SockInventory.Remove(male.GetComponentInChildren <VanGogh>().gameObject); GameObject.FindGameObjectWithTag("Player").GetComponent <CameraTest>().SockInventory.Remove(female.GetComponentInChildren <VanGogh>().gameObject); GameObject current = Instantiate(prefabPicture); current.GetComponent <VanGogh>().ApplyTheStyle(child[0], child[1], child[2]); bgroup.Effacer(); GameObject.FindGameObjectWithTag("Player").GetComponent <CameraTest>().SockInventory.Add(current); bgroup.Afficher(); }