Exemplo n.º 1
0
    public int AdjustTimeScale(TimeAdjuster adjustTime)
    {
        int index = adjustments.Count;

        adjustments.Add(adjustTime);
        return(index);
    }
Exemplo n.º 2
0
    private void Update()
    {
        List <TimeAdjuster> currentAdjusters = new List <TimeAdjuster>();

        foreach (TimeAdjuster adjuster in adjustments)
        {
            if (adjuster.AdjustCheck.Invoke())
            {
                currentAdjusters.Add(adjuster);
            }
        }

        float min = 1f;

        for (int i = 0; i < currentAdjusters.Count; i++)
        {
            TimeAdjuster adjuster = currentAdjusters[i];

            float val = adjuster.value;
            if (val < min)
            {
                min = val;
            }
        }

        currentTimeScale    = min;
        Time.timeScale      = currentTimeScale;
        Time.fixedDeltaTime = defaultFixedDeltaTime * Time.timeScale;
    }
Exemplo n.º 3
0
    public void ActivateTimeScaler(BoolAction checkBool)
    {
        TimeAdjuster adjuster = new TimeAdjuster(1f, checkBool);

        activatedTimeScaler = TimeScaleManager.Instance.AdjustTimeScale(adjuster);
    }