Dynamic Header ScriptingDark Center BandCode
Manual

Progressor

Code examples to perform various interactions with the Progressor

Update Progress Targets

Update all the progress targets by calling the UpdateTarget method for each target

using Doozy.Engine.Progress;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public Progressor MyProgressor;
        
    private void Start()
    {
        MyProgressor.UpdateProgressTargets();
    }
}

Set Value

Update the current Value for this Progressor

using Doozy.Engine.Progress;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public float MyValue;
    public Progressor MyProgressor;
        
    private void Start()
    {
        MyProgressor.SetValue(MyValue);
    }
}

Set Value – instantly (without animation)

Update the current Value for this Progressor. Ignores the AnimateValue option if instantUpdate is passed as TRUE

using Doozy.Engine.Progress;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public float MyValue;
    public Progressor MyProgressor;
        
    private void Start()
    {
        MyProgressor.SetValue(MyValue, true);
    }
}

Instant Set Value

Update the current Value for this Progressor instantly, without animating the value

using Doozy.Engine.Progress;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public float MyValue;
    public Progressor MyProgressor;
        
    private void Start()
    {
        MyProgressor.InstantSetValue(MyValue);
    }
}

Set Progress

Updates the current Value for this Progressor by updating the Progress value (progressValue is clamped between 0 and 1)
current Value = MinValue + progressValue * (MaxValue – MinValue)

using Doozy.Engine.Progress;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public float MyProgressValue; //value between 0 and 1
    public Progressor MyProgressor;
        
    private void Start()
    {
        MyProgressor.SetProgress(MyProgressValue);
    }
}

Set Progress – instantly (without animation)

Updates the current Value for this Progressor by updating the Progress value (progressValue is clamped between 0 and 1).
Ignores the AnimateValue option if instantUpdate is passed as TRUE.
current Value = MinValue + progressValue * (MaxValue – MinValue)

using Doozy.Engine.Progress;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public float MyProgressValue; //value between 0 and 1
    public Progressor MyProgressor;
        
    private void Start()
    {
        MyProgressor.SetProgress(MyProgressValue, true);
    }
}

Instant Set Progress

Updates the current Value for this Progressor instantly, without animating the value, by updating the Progress value (progressValue is clamped between 0 and 1)
current Value = MinValue + progressValue * (MaxValue – MinValue)

using Doozy.Engine.Progress;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public float MyProgressValue; //value between 0 and 1
    public Progressor MyProgressor;
        
    private void Start()
    {
        MyProgressor.InstantSetProgress(MyProgressValue);
    }
}

Get Progress

Depending on the direction (TargetProgress), returns either the Progress or the InverseProgress value

using Doozy.Engine.Progress;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public Progressor MyProgressor;

    private void Start()
    {
        float progressValue = MyProgressor.GetProgress(TargetProgress.Progress);               //value between 0 and 1
        float inverseProgressValue = MyProgressor.GetProgress(TargetProgress.InverseProgress); //value between 1 and 0
    }
}

Update Progress

Invoke the OnProgressChanged and OnInverseProgressChanged events

using Doozy.Engine.Progress;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public Progressor MyProgressor;

    private void Start()
    {
        MyProgressor.UpdateProgress();
    }
}

Set Min Value

Update the MinValue

using Doozy.Engine.Progress;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public float MyValue;
    public Progressor MyProgressor;

    private void Start()
    {
        MyProgressor.SetMin(MyValue);
    }
}

Set Max Value

Update the MaxValue

using Doozy.Engine.Progress;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public float MyValue;
    public Progressor MyProgressor;

    private void Start()
    {
        MyProgressor.SetMax(MyValue);
    }
}

Enable Whole Numbers

Force the current Value only be allowed to be whole numbers

using Doozy.Engine.Progress;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public Progressor MyProgressor;

    private void Start()
    {
        MyProgressor.EnableWholeNumbers();
    }
}

Disable Whole Numbers

Allow the current Value to be any fractional number

using Doozy.Engine.Progress;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public Progressor MyProgressor;

    private void Start()
    {
        MyProgressor.DisableWholeNumbers();
    }
}

Reset Value To

Resets the current Value to the set reset value. The reset happens instantly if instantUpdate is passed as TRUE

using Doozy.Engine.Progress;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public Progressor MyProgressor;

    private void Start()
    {
        //Reset to MinValue
        MyProgressor.ResetValueTo(ResetValue.ToMinValue, false); //resets the current Value to the MinValue (with animation)

        
        //Reset to MaxValue
        MyProgressor.ResetValueTo(ResetValue.ToMaxValue, false); //resets the current Value to the MaxValue (with animation)

        
        //Reset to a custom value
        MyProgressor.CustomResetValue = 1;                          //set the custom reset value
        MyProgressor.ResetValueTo(ResetValue.ToCustomValue, false); //resets the current Value to the set CustomValue (with animation)
    }
}

Reset Value To – instantly (without animation)

Resets the current Value to the set reset value instantly

using Doozy.Engine.Progress;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public Progressor MyProgressor;

    private void Start()
    {
        //Reset to MinValue
        MyProgressor.ResetValueTo(ResetValue.ToMinValue); //resets the current Value to the MinValue (instantly - without animation)

        
        //Reset to MaxValue
        MyProgressor.ResetValueTo(ResetValue.ToMaxValue); //resets the current Value to the MaxValue (instantly - without animation)

        
        //Reset to a custom value
        MyProgressor.CustomResetValue = 1;                          //set the custom reset value
        MyProgressor.ResetValueTo(ResetValue.ToCustomValue); //resets the current Value to the set CustomValue (instantly - without animation)
    }
}