protected void GraphPopulate(bool enableGraphButton) { if (graphControl.tracer.points.Count == 0) { graphButton.interactable = false; return; } graphControl.GraphPopulate(); if (enableGraphButton) { graphButton.interactable = true; } }
IEnumerator DoPlayer() { graphControl.tracer.body = mPlayerBody; while (true) { //wait for player to enable body while (!mPlayerBody.simulated) { yield return(null); } graphButton.interactable = false; //start recording graphControl.tracer.Record(); //player duration float lastTime = Time.time; do { float curTime = Time.time; if (curTime - lastTime >= playerAliveDuration) { //player expired signalDeath.Invoke(); break; } yield return(null); } while(mPlayerBody.simulated); graphControl.tracer.Stop(); graphControl.GraphPopulate(); graphButton.interactable = true; } }