Exemple #1
0
    private void UpdateState()
    {
        button.GetComponentInChildren <Text>().text = (data.buildings[BuildIndex]).ToString();
        state = data.Stateof((BuildingType)BuildIndex);

        if (state != BuildState.isBuilding)
        {
            image.fillAmount = 1f;
        }
        if (state == BuildState.CantBuild)
        {
            button.interactable = false;
            stateImage.sprite   = null;
            image.color         = Color.gray;
            stateImage.color    = trans;
        }
        else
        {
            button.interactable = true;
            image.color         = Color.white;
            stateImage.sprite   = SpriteHandler.GetBuildFrame(state);
        }
    }