示例#1
0
    //Set a value to an exact number. Example: Set the state of marriage to 1
    public void setValue(valueDefinitions.values type, float valueToSet)
    {
        bool  found = false;
        float oldValue;
        float valueDifference;

        foreach (ValueScript vs in values)
        {
            if (vs.valueType == type)
            {
                if (found == true)
                {
                    Debug.LogWarning("Multiple values of the same type detected: " + type.ToString());
                }

                found    = true;
                oldValue = vs.value;
                vs.setValue(valueToSet);
                valueDifference = oldValue - vs.value;

                //display the value change to the user
                if (vs.UserInterface.showActualization == true)
                {
                    InfoDisplay.instance.addDisplay(vs.UserInterface.miniatureSprite, valueDifference);
                }
            }
        }

        if (found == false)
        {
            Debug.LogWarning("Missing value type: " + type.ToString());
        }
    }
    void actualize()
    {
        ValueScript vs = valueManager.instance.getFirstFittingValue(modifier);

        if (vs != null)
        {
            value = valueManager.instance.getFirstFittingValue(modifier).value;
            actualizeIconsBaseOnValue();
        }
        else
        {
            Debug.LogError("The value '" + modifier.ToString() + "' couldn't be found int the manager.");
        }
    }
示例#3
0
    public void setPreview(valueDefinitions.values type, float valueChange, bool randomIndependant)
    {
        bool        found = false;
        ValueScript vs    = getFirstFittingValue(type);

        if (vs != null)
        {
            vs.setPreviewValues(valueChange, randomIndependant);
        }
        else
        {
            Debug.LogWarning("Missing value type for preview: " + type.ToString());
        }
    }