Ejemplo n.º 1
0
 void RefreshPopulationCirclePosition()
 {
     for (int i = 0; i < GetCollumTransform().childCount; i++)
     {
         for (int f = 0; f < GetCollumTransform().GetChild(i).GetChild(2).childCount; f++)
         {
             PopulationCircle populationCircle = GetCollumTransform().GetChild(i).GetChild(2).GetChild(f).GetComponent <PopulationCircle>();
             populationCircle.GetComponent <RectTransform>().localPosition = new Vector2(populationCircle.GetComponent <RectTransform>().localPosition.x, FindCirclePosition(populationCircle.population));
         }
     }
 }
Ejemplo n.º 2
0
    GameObject CreateCircle(Color _color, GameObject _verticalCollum, int _populationCount, BasicSpeciesScript _species)
    {
        GameObject newCircle = Instantiate(populationCircle);

        newCircle.transform.SetParent(_verticalCollum.transform.GetChild(2), false);
        newCircle.GetComponent <Image>().color = new Color(_color.r, _color.g, _color.b, 1);
        PopulationCircle newPopulationCircle = newCircle.GetComponent <PopulationCircle>();

        newPopulationCircle.population = _populationCount;
        newPopulationCircle.species    = _species;
        RectTransform rectTransform = newCircle.GetComponent <RectTransform>();

        rectTransform.anchoredPosition = new Vector2(2.5f, 0);
        rectTransform.sizeDelta        = new Vector2(5, 5);
        rectTransform.localPosition    = new Vector2(rectTransform.localPosition.x, FindCirclePosition(_populationCount));
        return(newCircle);
    }