public ColourData GetPreviousAvailableColour(int startPoint) // iterate through an array of colors to see what colors can be picked from { //colours[startPoint].isFree = true; if (startPoint == 0) { startPoint = colours.Length; } ColourData r_colours = new ColourData(); for (int i = startPoint - 1; i >= 0; i--) { if (colours[i].isFree == true) { colours[i].itr = i; //if the colour is free then set it and return. //colours[i].isFree = false; colours[i].playerID = i - 1; r_colours = colours[i]; Debug.Log(colours[i].name); Debug.Log(r_colours.playerID); return(r_colours); } } //r_colours.isFree = false; //r_colours.colour = white; //r_colours.playerID = 10; return(r_colours); }
//Returns the colour data and whether it is free or not. //public ColourData GetColour(COLOURS a_colours) //{ // ColourData r_colours = new ColourData(); // r_colours.isFree = !array[(int)a_colours]; // // //Checks whether the colour is free // if (r_colours.isFree == true) // { // r_colours.colour = colours[a_colours]; // array[(int)a_colours] = true; // r_colours.playerID = (int)a_colours; // } // else // { // r_colours.colour = white; // r_colours.playerID = 10; // } // // return r_colours; //} //Free's the colour for other use [cam] //public void FreeColour(COLOURS a_colours) //{ // //Set the colour to be available [cam] // array[(int)a_colours] = false; //} //Loops through and finds the next available colour [cam] public ColourData SpawnColour() { ColourData r_colours = new ColourData(); for (int i = 0 + 1; i <= colours.Length; i++) { if (colours[i].isFree == true) { colours[i].itr = i; //if the colour is free then set it and return. colours[i].isFree = false; colours[i].playerID = i - 1; r_colours = colours[i]; Debug.Log(colours[i].name); Debug.Log(r_colours.playerID); newColors = true; return(r_colours); } } newColors = true; //r_colours.isFree = false; //r_colours.colour = white; //r_colours.playerID = 10; return(r_colours); }
public void selectColor(int startPoint) { if (colours[startPoint].isFree == true) { colours[startPoint].isFree = false; } else { ColourData r_colours = new ColourData(); for (int i = startPoint + 1; i <= colours.Length; i++) { if (startPoint > 5) { startPoint = -1; } if (colours[i].isFree == true) { colours[i].itr = i; //if the colour is free then set it and return. //colours[i].isFree = false; colours[i].playerID = i - 1; r_colours = colours[i]; Debug.Log(colours[i].name); Debug.Log(r_colours.playerID); } } } }
private void Start() { ColourData temp = GetComponentInParent <bulletColour>().SpawnColour(); if (temp.isFree == false && MatchSettings.numPlayers == 0) // on character select [Graham] { Debug.Log("Setting Colour"); ColourOfBullet = temp.colour; colour = temp.colour; colourData = temp; GetComponentInChildren <SkinnedMeshRenderer>().material.color = colour; m_PlayerID = temp.playerID; GetComponentInParent <Unique>().GetComponentInChildren <BoostCollider>().setColour(colour); colourdull = colour; colourItr = colourData.itr; } else { Debug.Log("Setting Colour from match settings"); ColourOfBullet = colour; colourdull = colour; GetComponentInChildren <SkinnedMeshRenderer>().material.color = colour; GetComponentInParent <Unique>().GetComponentInChildren <BoostCollider>().setColour(colour); } }
public void TestXlsxParsingDataStructures_ColorTypeIndexed() { ColourData text = new ColourData("72", "", ColourType.Indexed); Assert.IsFalse(StyleInfoColor.IsWhiteText(text)); text = new ColourData("81", "", ColourType.Indexed); Assert.IsFalse(StyleInfoColor.IsWhiteText(text)); text = new ColourData("-1", "", ColourType.Indexed); Assert.IsFalse(StyleInfoColor.IsWhiteText(text)); text = new ColourData("65", "", ColourType.Indexed); Assert.IsFalse(StyleInfoColor.IsWhiteText(text)); text = new ColourData("66", "", ColourType.Indexed); Assert.IsFalse(StyleInfoColor.IsWhiteText(text)); text = new ColourData("1", "", ColourType.Indexed); Assert.IsTrue(StyleInfoColor.IsWhiteText(text)); text = new ColourData("9", "", ColourType.Indexed); Assert.IsTrue(StyleInfoColor.IsWhiteText(text)); text = new ColourData("64", "", ColourType.Indexed); Assert.IsTrue(StyleInfoColor.IsWhiteText(text)); }
public void InitializeColours(ColourData colourData) { this.colourData = colourData; Debug.Log("Init player colours"); GetComponents(); currentColourIndex = (uint)Random.Range(0, colourData.size); spriteRenderer.color = colourData.GetColourFromIndex(currentColourIndex); }
private void OnButtonClick(object sender, EventArgs e, CheckBox butt, ColourData <byte> colourData) { if (current.value != colourData.value) { current = colourData; SetSelected(); onValueChanged.Invoke(colourData.value); } }
private void Start() { ColourData temp = GetComponentInParent <bulletColour>().GetNextAvailableColour(); if (temp.isFree == true) { Debug.Log("Setting Colour"); ColourOfBullet = temp.colour; colour = temp.colour; GetComponentInChildren <SkinnedMeshRenderer>().material.color = colour; m_PlayerID = temp.playerID; GetComponentInParent <Unique>().GetComponentInChildren <BoostCollider>().setColour(colour); } }
public ObstacleGenerator(ObstacleData[] obstacles, ObstacleData colourSwapper, Transform container, ColourData colourData) { this.obstacles = obstacles; this.colourSwapper = colourSwapper; this.container = container; this.colourData = colourData; generatedObstacles = new List <IColorEntity>(); Generate(); GenerateColourSwapper(); Generate(); GenerateColourSwapper(); Generate(); GenerateColourSwapper(); Generate(); }
public void InitializeColours(ColourData colourData) { if (system == null) { return; } var copySystem = new ParticleSystem.Particle[system.main.maxParticles]; var count = system.GetParticles(copySystem); for (int i = 0; i < count; i++) { if (copySystem[i].startColor == Color.white) { copySystem[i].startColor = colourData.GetRandomColour(); } } system.SetParticles(copySystem, count); }
//Returns the colour data and whether it is free or not. public ColourData GetColour(COLOURS a_colours) { ColourData r_colours = new ColourData(); r_colours.isFree = !array[(int)a_colours]; //Checks whether the colour is free if (r_colours.isFree == true) { r_colours.colour = colours[a_colours]; array[(int)a_colours] = true; r_colours.playerID = (int)a_colours; } else { r_colours.colour = white; r_colours.playerID = 10; } return r_colours; }
//Loops through and finds the next available colour [cam] public ColourData GetNextAvailableColour() { ColourData r_colours = new ColourData(); for (int i = 0; i <= counter; i++) { if (array[i] == false) { //if the colour is free then set it and return. r_colours.isFree = true; array[i] = true; r_colours.colour = colours[(COLOURS)i]; r_colours.playerID = i; return r_colours; } } r_colours.isFree = false; r_colours.colour = white; r_colours.playerID = 10; return r_colours; }
public static UI32.tableLayoutPanel1 GetTrainerColourButtonsFromFile(string file) { string titleThing = ""; List <ColourData <byte> > colours = new List <ColourData <byte> >(); using (var reader = new StreamReader(file)) { int l = 0; while (!reader.EndOfStream) { l++; string line = reader.ReadLine(); string[] values = line.Split(','); if (l == 1) { titleThing = values[1]; } if (l > 5) { string[] colourNameSplit = values[0].Split('-'); byte val = byte.Parse(values[1], System.Globalization.NumberStyles.HexNumber); Color col = ColorTranslator.FromHtml(colourNameSplit[0]); string colName = colourNameSplit[1]; ColourData <byte> colourD = new ColourData <byte>(col, colName, val); colours.Add(colourD); } } return(new tableLayoutPanel1(titleThing, colours.ToArray())); } }
public Color selectColourLeft() { //if (colourData.itr == 6) //{ // colourData.itr = 0; //} ColourData temp = GetComponentInParent <bulletColour>().GetPreviousAvailableColour(colourItr); if (temp.isFree == true) { colourData = temp; //Debug.Log("Setting Colour"); ColourOfBullet = temp.colour; colour = temp.colour; colourdull = temp.colour; GetComponentInChildren <SkinnedMeshRenderer>().material.color = colour; GetComponentInParent <Unique>().GetComponentInChildren <BoostCollider>().setColour(colour); colourItr = colourData.itr; } return(colour); }
public void drawMesh(MeshData meshData, ColourData colourData, Material material) { // Debug.Log(meshData); this.colourData = colourData; Mesh mesh = meshData.CreateMesh(); float[] heights = findMinMax(mesh.uv); colourData.mat.SetFloat("minHeight", -15); colourData.mat.SetFloat("maxHeight", 15); //Debug.Log("Max height : " + heights[1]); //Debug.Log("Min height : " + heights[0]); //Debug.Log("height: " + mesh.uv[mesh.uv.Length / 2]); colourData.mat.SetColorArray("baseColours", colourData.baseColours); colourData.mat.SetFloatArray("baseStartHeights", colourData.baseStartHeights); colourData.mat.SetInt("baseColourCount", colourData.baseColours.Length); colourData.mat.SetFloatArray("baseBlends", colourData.baseBlends); meshFilter.sharedMesh = mesh; meshCollider.sharedMesh = mesh; }
public ButtonColourData(CheckBox button, ColourData <T> colourData) { this.button = button; this.colourData = colourData; }
void ColourChooser() //Chooses a random colour scheme each call, matching the background and cube, with contrasting ghoul and player colours { Renderer cubeColour, playerColour, ghoulmateColour; Camera cameraColour; cameraColour = GameObject.Find("Main Camera").GetComponent <Camera>(); cubeColour = GameObject.Find("Cube").GetComponent <MeshRenderer>(); ghoulmateColour = GameObject.Find("Ghoulmate(Clone)").transform.Find("Sphere").GetComponent <SkinnedMeshRenderer>(); playerColour = GameObject.Find("Player(Clone)").transform.Find("Sphere").GetComponent <SkinnedMeshRenderer>(); ColourData green = ScriptableObject.CreateInstance <ColourData>(); ColourData blue = ScriptableObject.CreateInstance <ColourData>(); ColourData yellow = ScriptableObject.CreateInstance <ColourData>(); ColourData orange = ScriptableObject.CreateInstance <ColourData>(); ColourData red = ScriptableObject.CreateInstance <ColourData>(); ColourData pink = ScriptableObject.CreateInstance <ColourData>(); ColourData purple = ScriptableObject.CreateInstance <ColourData>(); ColourData black = ScriptableObject.CreateInstance <ColourData>(); green.Init("green", cameraGreen, cubeGreen, greenGhoulmates); blue.Init("blue", cameraBlue, cubeBlue, blueGhoulmates); yellow.Init("yellow", cameraYellow, cubeYellow, yellowGhoulmates); orange.Init("orange", cameraOrange, cubeOrange, orangeGhoulmates); red.Init("red", cameraRed, cubeRed, redGhoulmates); pink.Init("pink", cameraPink, cubePink, pinkGhoulmates); purple.Init("purple", cameraPurple, cubePurple, purpleGhoulmates); black.Init("black", cameraBlack, cubeBlack, blackGhoulmates); ColourData[] colours = { green, blue, yellow, orange, red, pink, purple }; Material[] ghoulmates = { ghoulmatesGreen, ghoulmatesBlue, ghoulmatesYellow, ghoulmatesOrange, ghoulmatesRed, ghoulmatesPink, ghoulmatesPurple }; int random = Random.Range(0, colours.Length); if (levelCount % 10 == 0 && levelCount != 0) //Every 10 levels spawns a dark scene, only light visible is the player { timerRaw += 5; cameraColour.backgroundColor = black.colourCamera; cubeColour.material = black.colourCube; int randomBlack = Random.Range(0, black.colourGhoulmates.Length); ghoulmateColour.material = ghoulmates[black.colourGhoulmates[randomBlack]]; playerColour.material = ghoulmates[black.colourGhoulmates[randomBlack]]; Light light = GameObject.Find("Player(Clone)").transform.Find("Light").GetComponent <Light>();; light.enabled = true; //Following section disables emission light source on all AI and ghoulmate Renderer heart = GameObject.Find("LevelHeart").GetComponent <Renderer>(); heart.material.DisableKeyword("_EMISSION"); ghoulmateColour.material.DisableKeyword("_EMISSION"); GameObject[] ais = GameObject.FindGameObjectsWithTag("AI"); for (int i = 0; i < ais.Length; i++) { Renderer cur = ais[i].transform.Find("Sphere").GetComponent <SkinnedMeshRenderer>(); cur.material.DisableKeyword("_EMISSION"); } return; } cameraColour.backgroundColor = colours[random].colourCamera; cubeColour.material = colours[random].colourCube; int random2 = Random.Range(0, colours[random].colourGhoulmates.Length); if (levelCount % 5 == 0 && levelCount != 0) //Every level ending in 5 ghoulmate is same colour as AI { ghoulmateColour.material = AImaterial; } else { ghoulmateColour.material = ghoulmates[colours[random].colourGhoulmates[random2]]; } playerColour.material = ghoulmates[colours[random].colourGhoulmates[random2]]; }
public void OnColorChoice(object sender, Event evt) { wx.Object obj = evt.EventObject; SkinElementColor el = null; if (obj == m_background.m_rgbSelector) { el = m_background; } else if (obj == m_freeTrack.m_rgbSelector) { el = m_freeTrack; } else if (obj == m_reservedTrack.m_rgbSelector) { el = m_reservedTrack; } else if (obj == m_reservedShunting.m_rgbSelector) { el = m_reservedShunting; } else if (obj == m_occupiedTrack.m_rgbSelector) { el = m_occupiedTrack; } else if (obj == m_workingTrack.m_rgbSelector) { el = m_workingTrack; } else if (obj == m_outline.m_rgbSelector) { el = m_outline; } else if (obj == m_text.m_rgbSelector) { el = m_text; } else { return; } byte rv, gv, bv; String str; str = el.m_r.Value; rv = Globals.wxStrtoul(str, 0, 0); str = el.m_g.Value; gv = Globals.wxStrtoul(str, 0, 0); str = el.m_b.Value; bv = Globals.wxStrtoul(str, 0, 0); Colour elCol = new wx.Colour(rv, gv, bv); ColourData data = new ColourData(); data.ChooseFull = (true); data.Colour = (elCol); ColourDialog dialog = new ColourDialog(this, data); if (dialog.ShowModal() == ShowModalResult.OK) { ColourData retData = dialog.ColourData; wx.Colour col = retData.Colour; byte v = col.Red; str = String.Format(wxPorting.T("%d"), v); el.m_r.Value = (str); v = col.Green; str = String.Format(wxPorting.T("%d"), v); el.m_g.Value = (str); v = col.Blue; str = String.Format(wxPorting.T("%d"), v); el.m_b.Value = (str); } }
public void InitializeColours(ColourData colourData) { this.colourData = colourData; GetComponents(); spriteRenderer.color = colourData.GetColourFromIndex(colourIndex); }
// Use this for initialization void Start() { // Pull the color from the player's stats, step up to parent and then grab playerstats from the child [jack] playerColour = GetComponent <Transform>().parent.gameObject.GetComponentInChildren <PlayerStats>().colourData; meshRenderer = GetComponent <MeshRenderer>(); }