remove private variable
This commit is contained in:
parent
1582a10ce2
commit
950e2ae16e
1 changed files with 10 additions and 12 deletions
|
@ -26,7 +26,6 @@ namespace cylvester
|
||||||
|
|
||||||
private ScheduledAction scheduledAction_;
|
private ScheduledAction scheduledAction_;
|
||||||
private int currentTick_;
|
private int currentTick_;
|
||||||
private float restTime_ = 1f;
|
|
||||||
private int currentSelectedScene_ ;
|
private int currentSelectedScene_ ;
|
||||||
private int nextSelectedScene_;
|
private int nextSelectedScene_;
|
||||||
|
|
||||||
|
@ -69,16 +68,15 @@ namespace cylvester
|
||||||
}
|
}
|
||||||
case CylCommand.FourBarLoopButton:
|
case CylCommand.FourBarLoopButton:
|
||||||
{
|
{
|
||||||
|
var restTime = UpdateRestTime(FourBarTrigger - currentTick_ % FourBarTrigger);
|
||||||
if (nextSelectedScene_ > currentSelectedScene_)
|
if (nextSelectedScene_ > currentSelectedScene_)
|
||||||
{
|
{
|
||||||
UpdateRestTime(FourBarTrigger - currentTick_ % FourBarTrigger);
|
UpdateTimelinePlaybackSpeed(1f, restTime);
|
||||||
UpdateTimelinePlaybackSpeed(1f);
|
|
||||||
stateManager.SelectedState = nextSelectedScene_;
|
stateManager.SelectedState = nextSelectedScene_;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UpdateRestTime(FourBarTrigger - currentTick_ % FourBarTrigger);
|
UpdateTimelinePlaybackSpeed(-1f, restTime);
|
||||||
UpdateTimelinePlaybackSpeed(-1f);
|
|
||||||
stateManager.SelectedState = nextSelectedScene_ + 2;
|
stateManager.SelectedState = nextSelectedScene_ + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,8 +84,8 @@ namespace cylvester
|
||||||
}
|
}
|
||||||
case CylCommand.OneBarLoopButton:
|
case CylCommand.OneBarLoopButton:
|
||||||
{
|
{
|
||||||
UpdateRestTime(OneBarTrigger - currentTick_ % OneBarTrigger);
|
var restTime = UpdateRestTime(OneBarTrigger - currentTick_ % OneBarTrigger);
|
||||||
UpdateTimelinePlaybackSpeed(1f);
|
UpdateTimelinePlaybackSpeed(1f, restTime);
|
||||||
stateManager.SelectedState = nextSelectedScene_;
|
stateManager.SelectedState = nextSelectedScene_;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -97,15 +95,15 @@ namespace cylvester
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateRestTime(int restTicks)
|
private float UpdateRestTime(int restTicks)
|
||||||
{
|
{
|
||||||
restTime_ = restTicks / 24.0f / stateManager.CurrentState.Bpm * 60f;
|
return restTicks / 24f / stateManager.CurrentState.Bpm * 60f;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateTimelinePlaybackSpeed(float speed)
|
private void UpdateTimelinePlaybackSpeed(float speed, float restTime)
|
||||||
{
|
{
|
||||||
var timelinePlaybackSpeed = TransitionLength / Mathf.Clamp(restTime_, 0.001f, TransitionLength);
|
var timelinePlaybackSpeed = TransitionLength / Mathf.Clamp(restTime, 0.001f, TransitionLength);
|
||||||
playableDirector.playableGraph.GetRootPlayable(0).SetSpeed(timelinePlaybackSpeed * speed); //set playbackspeed of Timeline
|
playableDirector.playableGraph.GetRootPlayable(0).SetSpeed(timelinePlaybackSpeed * speed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue