Пример #1
0
    private IEnumerator ScenarioExecution()
    {
        switch (step)
        {
        case Step.Attraction: {
            if (OrbitController.Instance != null)
            {
                OrbitController.Instance.Apply(p.camView);
            }

            yield return(null);

            break;
        }

        case Step.AttractionUpDown: {
            m_AttractionUpDownCoroutine = StartCoroutine(AttractionUpDownCoroutine());

            step     = Step.Idle;
            parallel = Parallel.LerpToSeparation;
            break;
        }

        case Step.SettleCohesion: {
            Tween.DestroyAll(flock.originTarget.gameObject);
            //Scene_Camera.Instance.SmoothLookAt ( flock.originTarget, 2f, false );
            flock.TransitionToPreset(p.fishSchool1Preset, p.fishSchool1TransitionDuration);
            ConvertBoidsToTemplate(p.fish1Template, p.fishSchool1TransitionDuration);

            float       transitionDuration = p.fishSchool1TransitionDuration * .5f;
            IEnumerator transition         = GenericPresetsUtil.TransitionFromToCoroutine(
                null, p.underwaterOn, p.underwaterMaterial,
                transitionDuration,
                null, null
                );

            StartCoroutine(transition);

            IEnumerator transitionBkg = GenericPresetsUtil.TransitionFromToCoroutine(
                null, p.backgroundWater, p.backgroundMaterial,
                transitionDuration,
                null, null
                );

            StartCoroutine(transitionBkg);

            step     = Step.Idle;
            parallel = Parallel.Idle;
            break;
        }

        case Step.School2: {
            if (m_AttractionUpDownCoroutine != null)
            {
                StopCoroutine(m_AttractionUpDownCoroutine);
            }

            flock.TransitionToPreset(p.fishSchool2Preset, p.fishSchool2TransitionDuration);
            flock.CreateBoidsOverDuration(p.additionalSchool2Pattern, p.fishSchool2TransitionDuration);
            Infinity.Apply(flock.originTarget.gameObject, 10f, 6f, .01f);

            step = Step.Idle;
            break;
        }

        case Step.Birds: {
            Infinity.Remove(flock.originTarget.gameObject);

            StartCoroutine(flock.RandomOriginFromBoidsCoroutine(1f));
            OrbitController.Instance.orbitTarget        = flock.originTarget;
            OrbitController.Instance.rotationalDamping *= .2f;

            flock.TransitionToPreset(p.birdsFlock1Preset, p.birdsFlock1TransitionDuration);
            ConvertBoidsToTemplate(p.birds1Template, p.birdsFlock1TransitionDuration);
            flock.CreateBoidsOverDuration(p.additionalSchool2Pattern, p.birdsFlock1TransitionDuration);

            float       transitionDuration = p.birdsFlock1TransitionDuration * .5f;
            IEnumerator transition         = GenericPresetsUtil.TransitionFromToCoroutine(
                null, p.skySunset, p.underwaterMaterial,
                transitionDuration,
                null, null
                );

            StartCoroutine(transition);

            IEnumerator transitionBkg = GenericPresetsUtil.TransitionFromToCoroutine(
                null, p.backgroundSkySunset, p.backgroundMaterial,
                transitionDuration,
                null, null
                );

            StartCoroutine(transitionBkg);

            step = Step.Idle;
            break;
        }

        case Step.Exit: {
            Director.Instance.LoadNextScene();
            break;
        }
        }
    }