コード例 #1
0
    private IEnumerator MakeLanding()
    {
        //TODO: POłączyć z telemarkiem, wybór lądowania uzależniony od miejsca kliknięcia
        BodyBack.SetActive(true);
        State = playerState.DuringTwoLegs;
        Jump.Play("Landing");
        const int  rotatingTime = 7; //Czas obrotu w klatkach
        Vector3    rotateValue;
        Quaternion finalAngle = Quaternion.Euler(new Vector3(0, 0, 335));

        if (transform.eulerAngles.z > 180 && transform.eulerAngles.z < finalAngle.eulerAngles.z)
        {
            rotateValue = new Vector3(0, 0, (Quaternion.Angle(finalAngle, transform.rotation)) / rotatingTime);
        }
        else
        {
            rotateValue = new Vector3(0, 0, -(Quaternion.Angle(finalAngle, transform.rotation)) / rotatingTime);
        }
        rotateValue.z = Mathf.Clamp(rotateValue.z, -6, 6);

        while (Jump.isPlaying)
        {
            if (Quaternion.Angle(finalAngle, transform.rotation) > (rotateValue.z + 1))
            {
                transform.Rotate(rotateValue);
            }
            _animProgress += 1;
            yield return(null);
        }
        State = playerState.LandingTwoLegs;
    }
コード例 #2
0
    private void FallDown()
    {
        BodyBack.SetActive(true);
        AnimationState animState;

        StopAllCoroutines();
        State = playerState.Fall;
        //TODO: Przenieść do managera animacji
        if (Random.Range(0f, 4f) > 1)
        {
            Jump.CrossFade("Fall");
            animState = Jump.PlayQueued("AfterFall");
        }
        else
        {
            Jump.CrossFade("Fall2");
            animState = Jump.PlayQueued("AfterFall2");
        }
        _rb.gravityScale = 2f;
        if (_currentShadowPrefab != null)
        {
            Destroy(_currentShadowPrefab);
            _currentShadowPrefab = Instantiate(ShadowPrefab2);
        }
        if (!_isOnHill)
        {
            CalculateNotes(GetDistance());
        }
        else
        {
            CalculateNotes(GetDistance(true));
        }
        StartCoroutine(AnimationCooling(animState));
    }