Example #1
0
    void Start()
    {
        uiControl = FindObjectOfType<UIController>();
        hex = GetComponentInParent<Hex>();

        hexTrait = hex.GetGeography();
        hexVal = (int)hexTrait;
        icon = GetComponent<Image>();
        icon.sprite = uiControl.GetGeoSprite(hexTrait);
        icon.color = uiControl.GetGeoSpriteColor(hexTrait);
    }
Example #2
0
    void Update()
    {
        prevVal = hexVal;
        hexTrait = hex.GetGeography();
        hexVal = (int)hexTrait;

        icon = GetComponent<Image>();

        if(hexVal != prevVal){
            prevVal = hexVal;

            icon.sprite = uiControl.GetGeoSprite(hexTrait);
            icon.color = uiControl.GetGeoSpriteColor(hexTrait);
        }
    }