private bool CompareColors(Color left, Color right) { Color32 color = left; Color32 color2 = right; return(color.Equals(color2)); }
public void SetTile( int x, int y, char character, Color32 color = default(Color32) ) { if (color.Equals( default(Color32)) ) color = Color.white; tiles_[x,y] = character; colors_[x,y] = color; }
// determines the game object corresponding to the given color GameObject ColorToObject(Color32 color) { if (color.Equals(playerSpawnColor)) { return playerPrefab; } else if (color.Equals(tileColor)) { return tilePrefab; } else if (color.Equals(enemySpawnColor)) { return enemySpawnerPrefab; } else if (color.Equals(airColor)) { return null; } else if (color.Equals(pinkColor)) { GameObject prefab = fountainPrefab; prefab.GetComponent<Fountain>().iceCreamType = Utils.IceCream.Pink; return prefab; } else if (color.Equals(vanillaColor)) { GameObject prefab = fountainPrefab; prefab.GetComponent<Fountain>().iceCreamType = Utils.IceCream.White; return prefab; } else if (color.Equals(brownColor)) { GameObject prefab = fountainPrefab; prefab.GetComponent<Fountain>().iceCreamType = Utils.IceCream.Brown; return prefab; } else { print("An unrecognized color was found in the map! Something is wrong!"); print(color); return null; } }
void onSelectColorListener(Color32 color) { if (!color.Equals(PropertiesSingleton.instance.colorProperties.activeColor)){ Color32 oldColor = PropertiesSingleton.instance.colorProperties.activeColor; PropertiesSingleton.instance.colorProperties.activeColor = color; if (WorkspaceEventManager.instance.onColorChanged!=null) WorkspaceEventManager.instance.onColorChanged(color,oldColor); } updateMaterials(); }
private Color32 generateRandomColor(Color32 mix) { System.Random random = new System.Random(); byte red = (byte) random.Next(256); byte green = (byte) random.Next(256); byte blue = (byte) random.Next(256); if (!mix.Equals(null)) { red = (byte) ((red + mix.r) / 2); green = (byte) ((green + mix.g) / 2); blue = (byte) ((blue + mix.b) / 2); } Color32 color = new Color32(red, green, blue, 255); return color; }
private Color32 generateRandomColor(Color32 mix) { // UnityEngine.Random random = new UnityEngine.Random(); byte red = (byte) Random.Range(0,256); byte green = (byte) Random.Range(0,256); byte blue = (byte) Random.Range(0,256); if (!mix.Equals(null)) { red = (byte) ((red + mix.r) / 2); green = (byte) ((green + mix.g) / 2); blue = (byte) ((blue + mix.b) / 2); } Color32 color = new Color32(red, green, blue, 255); return color; }