In case it helps future people (and feel free to correct it Robertbu!) here is the solution I'm using based on the discussion we had, seems to be working only being about 1 to 2 seconds off.
function SkipDialogLineAction (){
if (dialogInteractions.currentState == DialogStates.ShowTextLine){
//Store the current world time and the dialogTimeLeft
var currentWorldTime = scriptWorld.worldTime;
var dialogTimeLeft = dialogInteractions.textLineDisplayTimeLeft + dialogInteractions.endDialogPause;
//Cancel current dialog
dialogInteractions.StopCoroutine("DoTextLine");
dialogInteractions.currentDisplayLine = null;
dialogInteractions.currentState = DialogStates.Idle;
//Advance game time based on how much of the dialog was left
Time.timeScale = 90;
yield WaitForSeconds (dialogTimeLeft);
//Bring timescale back to 1 and correct worldTime
Time.timeScale = 1;
scriptWorld.worldTime = currentWorldTime + dialogTimeLeft;
}
}
↧