I am trying to obtain the Color list along with the array point that it is associated with while colliding, I have a whole mesh set up with colors on each vertex, While colliding I am attempting to collect the color of the colliding vertex and compare the two colors. Though I am unable to figure out how to associate them with each other. If someone could help me with this I would be very grateful as this is an important part of the project.
Here is a snippet:
if(gameObject.CompareTag("Organism") && other.gameObject.CompareTag("Organism") && isAlive == true) {
Color thisColor = gameObject.GetComponent<OrganismCreation>().colors[Random.Range(0, gameObject.GetComponent<OrganismCreation>().colors.Count)];
Color otherColor = other.gameObject.GetComponent<OrganismCreation>().colors[Random.Range(0, other.gameObject.GetComponent<OrganismCreation>().colors.Count)];
//if this color is in the Red zone and the other color is in the Green zone
if((thisColor.r > otherColor.g) && (organismMutationsScript.isHerbivore == true && other.gameObject.GetComponent<Mutations>().isPlant == true) && other.gameObject.GetComponent<OrganismScript>().biomassCount >= 0.001f * gameObject.GetComponent<Mutations>().herbivoreMultiplier * other.gameObject.GetComponent<Mutations>().plantMultiplier && biomassCount <= organismMutationsScript.maxBiomass) {
biomassCount += 0.001f * gameObject.GetComponent<Mutations>().herbivoreMultiplier * other.gameObject.GetComponent<Mutations>().plantMultiplier;
other.gameObject.GetComponent<OrganismScript>().biomassCount -= 0.001f * gameObject.GetComponent<Mutations>().herbivoreMultiplier * other.gameObject.GetComponent<Mutations>().plantMultiplier;
}
//if this color is in the Yellow zone and the other color is in the Red zone
if(((thisColor.r + thisColor.g) / 2) > otherColor.r && (organismMutationsScript.isCarnivore == true && other.gameObject.GetComponent<Mutations>().isHerbivore == true) && other.gameObject.GetComponent<OrganismScript>().biomassCount >= 0.001f * gameObject.GetComponent<Mutations>().carnivoreMultiplier && biomassCount <= organismMutationsScript.maxBiomass) {
biomassCount += 0.001f * gameObject.GetComponent<Mutations>().carnivoreMultiplier;
other.gameObject.GetComponent<OrganismScript>().biomassCount -= 0.001f * gameObject.GetComponent<Mutations>().carnivoreMultiplier;
}
}