Beispiel #1
0
    private IEnumerator ShowCoroutine(Action onFinish)
    {
        yield return(UtilityCoroutines.LerpCoroutine(_VectorA, Vector3.zero, _VectorAPosition, Scenario.AnimTime));

        yield return(new WaitForSeconds(Scenario.AnimTime / 5));

        _VectorB.gameObject.SetActive(true);
        yield return(UtilityCoroutines.LerpCoroutine(_VectorB, Vector3.zero, _VectorBPosition, Scenario.AnimTime));

        yield return(new WaitForSeconds(Scenario.AnimTime / 5));

        yield return(UtilityCoroutines.LerpCoroutine(_VectorB.transform, Vector3.zero, _VectorAPosition, Scenario.AnimTime));

        yield return(new WaitForSeconds(Scenario.AnimTime / 5));

        _VectorB.SetLabel("-b");
        _VectorB.SetColor(Color.red);
        yield return(UtilityCoroutines.LerpCoroutine(_VectorB, Vector3.zero, -_VectorBPosition, Scenario.AnimTime));

        yield return(new WaitForSeconds(Scenario.AnimTime / 5));

        _VectorResult.gameObject.SetActive(true);
        yield return(UtilityCoroutines.LerpCoroutine(_VectorResult, Vector3.zero, _VectorAPosition - _VectorBPosition,
                                                     Scenario.AnimTime));

        yield return(new WaitForSeconds(Scenario.AnimTime / 5));

        yield return(new WaitForSeconds(Scenario.AnimTime));

        onFinish?.Invoke();
    }
    private IEnumerator ShowCoroutine(Action onFinish)
    {
        yield return(UtilityCoroutines.LerpCoroutine(_VectorA, Vector3.zero, _VectorAPosition, Scenario.AnimTime));

        yield return(new WaitForSeconds(Scenario.AnimTime / 5));

        _VectorB.gameObject.SetActive(true);
        yield return(UtilityCoroutines.LerpCoroutine(_VectorB, Vector3.zero, _VectorBPosition, Scenario.AnimTime));

        yield return(new WaitForSeconds(Scenario.AnimTime / 5));

        _VectorC.gameObject.SetActive(true);
        yield return(UtilityCoroutines.LerpCoroutine(_VectorC, Vector3.zero,
                                                     _VectorAPosition + _VectorBPosition, Scenario.AnimTime));

        yield return(new WaitForSeconds(Scenario.AnimTime / 5));

        yield return(new WaitForSeconds(Scenario.AnimTime / 5));

        _VectorD.gameObject.SetActive(true);
        var dv = _VectorAPosition + _VectorBPosition;

        yield return(UtilityCoroutines.LerpCoroutine(_VectorD.transform, Vector3.zero,
                                                     (_VectorAPosition + _VectorBPosition) / 2, Scenario.AnimTime));

        yield return(UtilityCoroutines.LerpCoroutine(_VectorD, Vector3.zero,
                                                     (_VectorAPosition + _VectorBPosition) / 2 - _VectorBPosition, Scenario.AnimTime));

        yield return(new WaitForSeconds(Scenario.AnimTime / 5));

        yield return(UtilityCoroutines.LerpCoroutine(_VectorD.transform, _VectorD.transform.localPosition,
                                                     _VectorBPosition, Scenario.AnimTime));

        yield return(new WaitForSeconds(Scenario.AnimTime / 5));

        _VectorNormal.gameObject.SetActive(true);
        yield return(UtilityCoroutines.LerpCoroutine(_VectorNormal.transform, Vector3.zero,
                                                     (_VectorAPosition + _VectorBPosition) / 2, Scenario.AnimTime));

        yield return(UtilityCoroutines.LerpCoroutine(_VectorNormal, Vector3.zero,
                                                     new Vector3(-dv.y, dv.x).normalized, Scenario.AnimTime));

        yield return(new WaitForSeconds(Scenario.AnimTime * 2));

        onFinish?.Invoke();
    }
    private IEnumerator ShowCalculationsCoroutine(Vector3 startPosition, Vector3 hitpoint, Vector3 hitnormal,
                                                  float distanceFromPlanet, float offset)
    {
        var right        = Vector3.Cross(hitnormal, Vector3.up).normalized;
        var normalOffset = hitpoint + hitnormal * distanceFromPlanet;
        var endPosition  = normalOffset + right * offset;
        var vectorRay    = Instantiate(_VectorArrowPrefab);

        vectorRay.SetLabel("raycast");
        vectorRay.SetColor(Color.green);
        yield return(UtilityCoroutines.LerpCoroutine(vectorRay, startPosition, hitpoint, AnimTime));

        var vectorNormal = Instantiate(_VectorArrowPrefab);

        vectorNormal.SetLabel("hit normal * distance from planet");
        yield return(UtilityCoroutines.LerpCoroutine(vectorNormal, hitpoint,
                                                     normalOffset, AnimTime));

        var vectorOffset = Instantiate(_VectorArrowPrefab);

        vectorOffset.SetLabel("offset");
        yield return(UtilityCoroutines.LerpCoroutine(vectorOffset, normalOffset,
                                                     endPosition, AnimTime));
    }