public void Following_Update() { //followHandler.Enable = true; //Leave UserMode and Being AI Mode AIVehicle.SetActive(true); if (Input.GetButtonDown(VRAVEStrings.Right_Paddle)) { (UserCar.GetComponent <CarUserControl>() as CarUserControl).enabled = false; cameraFade.StartAlphaFade(Color.black, false, 2f, () => { ChangeState(States.ChangeMode); cameraFade.ResetPlane(); }); } }
private IEnumerator postStopStateChange(float time) { yield return(new WaitForSeconds(time)); cameraFade.StartAlphaFade(Color.black, false, 3f, () => { if (GetState().Equals(States.UserStopped)) //fix this so I'm not checking states all the time //Debug.Log("Preparing to reset scenario..."); { resetScenario(); cameraFade.ResetPlane(); ChangeState(States.AIDriveRoute); } else { cameraFade.ResetPlane(); //Debug.Log("Else statement reached in postStopStateChange()"); } }); }
/************* Coroutines *****************/ private IEnumerator PostCollisionStateChange(float time) { yield return(new WaitForSeconds(time)); mirrorFlag = 0; // use a lambda expression to define the callback cameraFade.StartAlphaFade(Color.black, false, 3f, () => { if (m_humanDrivingState) { UserCar.SetActive(false); resetIntersectionScenario(); cameraFade.ResetPlane(); ChangeState(States.AIDrivingToIntersectionBriefing); } else { cameraFade.ResetPlane(); ChangeState(States.TrashcanBriefing); } }); }