Пример #1
0
 public TimeRamp StartDownIn(float waitTime)
 {
     _hasPending = true;
     rampState   = RampState.reachedOne;
     //   if (ignoreTimeScale)
     //       pendingTime = Time.time + waitTime * Time.timeScale;
     //  else
     pendingTime  = Time.time + waitTime;
     pendingState = RampState.goingDown;
     return(this);
 }
Пример #2
0
    /// <summary>
    /// changes the direction of the ramp - used mainly internally
    /// </summary>

    public TimeRamp TurnUp()
    {
        if (triggerCallbacksOnDirectionChange)
        {
            _callbackZero();
        }
        float v = (Time.time - startTime) / duration;

        startTime = Time.time - duration * (1 - v);
        rampState = RampState.goingUp;
        return(this);
    }
Пример #3
0
    /// <summary>
    /// Tells the ramp to go towards ZERO, reverses the movement if going UP, does nothing if it already goes ZERO, forces one update if reached ZERO
    /// </summary>

    public TimeRamp GoZero()
    {
        switch (rampState)
        {
        case RampState.reachedZero:
            rampState = RampState.goingDown;     // will force at least one update
            break;

        case RampState.goingDown:
            return(this);

        case RampState.reachedOne:
            StartFromOne();
            break;

        case RampState.goingUp:
            TurnDown();
            break;
        }
        return(this);
    }
Пример #4
0
 public TimeRamp Stop()
 {
     rampState   = RampState.reachedZero;
     _hasPending = false;
     return(this);
 }
Пример #5
0
    /// <summary>
    /// Use GoOne if you think ramp might be already running
    /// </summary>

    public TimeRamp StartFromZero()
    {
        startTime = Time.time;
        rampState = RampState.goingUp;
        return(this);
    }
Пример #6
0
    /// <summary>
    /// Use GoZero if you think ramp might be already running
    /// </summary>

    public TimeRamp StartFromOne()
    {
        startTime = Time.time;
        rampState = RampState.goingDown;
        return(this);
    }