void CreateCreatureLine(int line, int point, Vector2 cursorCoords, WorldTreeLineData[] worldTreeLines) { int index = (line + worldTreeNumSpeciesLines) * worldTreeNumPointsPerLine + point; SpeciesGenomePool pool = simManager.masterGenomePool.completeSpeciesPoolsList[selectionManager.currentSelection.historySelectedSpeciesID]; if (line >= pool.candidateGenomesList.Count) { return; } WorldTreeLineData data = new WorldTreeLineData(); CandidateAgentData cand = pool.candidateGenomesList[line]; float xCoord = (float)point / (float)worldTreeNumPointsPerLine; int numAgentsDisplayed = Mathf.Max(pool.GetNumberAgentsEvaluated(), 1); // Prevent divide by 0 float yCoord = 1f - (float)line / (float)numAgentsDisplayed; int timeStepStart = Mathf.RoundToInt(timelineStartTimeStep); float xStart = (float)(pool.candidateGenomesList[line].performanceData.timeStepHatched - timeStepStart) / (float)(simManager.simAgeTimeSteps - timeStepStart); float xEnd = 1f; if (pool.isExtinct || cand.performanceData.timeStepDied > 1) { xEnd = (float)(cand.performanceData.timeStepDied - timeStepStart) / (float)(simManager.simAgeTimeSteps - timeStepStart); } bool inXBounds = xStart <= xCoord && xEnd >= xCoord; Vector3 hue = pool.foundingCandidate.candidateGenome.bodyGenome.appearanceGenome.huePrimary * 1.5f; data.color = GetCreatureLineColor(hue, cand, inXBounds); // new Color(hue.x, hue.y, hue.z);// Color.HSVToRGB(lerp, 1f - lerp, 1f); // Color.Lerp(Color.white, Color.black, lineID * 0.11215f); xCoord = xCoord * displayWidth + marginLeft; // rescaling --> make this more robust yCoord = yCoord * displayHeight + marginBottom; data.worldPos = new Vector3(xCoord, yCoord, 0f); // Mouse hover highlight if ((new Vector2(xCoord, yCoord) - cursorCoords).magnitude < 0.05f) { data.color = Color.white; } if (isTimelineMode) //if (isPopulationMode || isTimelineMode) { { data.worldPos = Vector3.zero; data.color = new Color(0f, 0f, 0f, 0f); } worldTreeLines[index] = data; }
/// Simple list, evenly spaced private void UpdateSpeciesIconsSinglePop() { foreach (var icon in speciesIcons) { // DEFAULTS float xCoord = -0.2f; float yCoord = 0.2f;// (float)s / Mathf.Max(speciesIconsList.Count - 1, 1f); int prevSpeciesIndex = selectionManager.currentSelection.historySelectedSpeciesID - 1; if (prevSpeciesIndex < 0) { prevSpeciesIndex = masterGenomePool.completeSpeciesPoolsList.Count - 1; } int nextSpeciesIndex = selectionManager.currentSelection.historySelectedSpeciesID + 1; if (nextSpeciesIndex >= masterGenomePool.completeSpeciesPoolsList.Count) { nextSpeciesIndex = 0; } // CYCLE PREV SPECIES if (icon.linkedPool.speciesID == prevSpeciesIndex) { xCoord = 0f; yCoord = 1f; } // SELECTED if (icon.linkedPool.speciesID == selectionManager.currentSelection.historySelectedSpeciesID) { xCoord = 0f; yCoord = 0.5f; } // CYCLE NEXT SPECIES if (icon.linkedPool.speciesID == nextSpeciesIndex) { xCoord = 0f; yCoord = 0f; } xCoord = xCoord * displayWidth + marginLeft; yCoord = yCoord * displayHeight + marginBottom; icon.SetTargetCoords(new Vector2(xCoord, yCoord)); } //*** UPDATE CREATURE ICONS!!!!!! v v v SpeciesGenomePool pool = simManager.masterGenomePool.completeSpeciesPoolsList[selectionManager.currentSelection.historySelectedSpeciesID]; int numAgentsDisplayed = Mathf.Max(pool.GetNumberAgentsEvaluated(), 1); // avoid divide by 0 for (int line = 0; line < worldTreeNumCreatureLines; line++) { if (line >= pool.candidateGenomesList.Count) { continue; } CandidateAgentData cand = pool.candidateGenomesList[line]; float xCoord = 1f; float yCoord = 1f - (float)line / (float)numAgentsDisplayed; Vector3 hue = pool.foundingCandidate.candidateGenome.bodyGenome.appearanceGenome.huePrimary * 2f; int timeStepStart = Mathf.RoundToInt(timelineStartTimeStep); if (pool.isExtinct || cand.performanceData.timeStepDied > 1) { xCoord = (float)(cand.performanceData.timeStepDied - timeStepStart) / (float)(simManager.simAgeTimeSteps - timeStepStart); } xCoord = xCoord * displayWidth + marginLeft; yCoord = yCoord * displayHeight + marginBottom; //***EAC FIX! uiManagerRef.speciesOverviewUI.SetButtonPos(line, new Vector3(xCoord * (float)panelSizePixels, yCoord * (float)panelSizePixels, 0f)); } }