Example #1
0
    private IEnumerator WaitSimComplete()
    {
        Debug.Log(">> routine: sim start");

        // ReSharper disable once UseObjectOrCollectionInitializer
        Composition.ControllerSim            = new ControllerSim();
        Composition.ControllerSim.BallColor  = Composition.BallColorConsent();
        Composition.ControllerSim.BallRadius = Composition.BallRadiusConsent();

        while (Composition.ControllerSim.GetFirstCompleteFinisher() == null)
        {
            Composition.ControllerSim.Update(Composition.ControllerInput);
            Composition.NetState.Send(
                Composition.ControllerSim.Frame,
                Composition.ControllerInput.HasChange);

            yield return(new WaitForEndOfFrame());
        }

        Debug.Log($">> sim complete, win: {Composition.ControllerSim.GetFirstCompleteFinisher().GetType().Name}");
    }