Beispiel #1
0
        private IEnumerator HighFive_Coroutine(float delay, bool rotate, Vector3 rotation)
        {
            yield return(new WaitForSeconds(delay));

            if (rotate)
            {
                var initialRotation = transform.rotation.eulerAngles;
                var finalRotation   = rotation;

                var rotationInterpolant  = 0f;
                var rotationLerpProgress = 0f;
                var rotationLerpLength   = 0.25f;

                while (rotationLerpProgress < rotationLerpLength)
                {
                    transform.rotation    = Quaternion.Euler(Vector3.Lerp(initialRotation, finalRotation, rotationInterpolant));
                    rotationLerpProgress += Time.deltaTime;
                    rotationInterpolant   = rotationLerpProgress / rotationLerpLength;
                    rotationInterpolant   = Mathf.Sin(rotationInterpolant * Mathf.PI * 0.5f);
                    yield return(new WaitForFixedUpdate());
                }
            }
            LLPrefab.DoHighFive();
        }
        void Update()
        {
            letter.HasFear = fear;
            letter.SetWalkingSpeed(walkSpeed);
            letter.SetDancingSpeed(danceSpeed);

            if (doTransition)
            {
                doTransition = false;
                letter.SetState(targetState);
            }

            if (doHooray)
            {
                doHooray = false;
                letter.DoHorray();
            }


            if (doAngry)
            {
                doAngry = false;
                letter.DoAngry();
            }


            if (doHighFive)
            {
                doHighFive = false;
                letter.DoHighFive();
            }


            if (onJumpStart)
            {
                onJumpStart = false;
                letter.OnJumpStart();
            }


            if (onJumpMiddle)
            {
                onJumpMiddle = false;
                letter.OnJumpMaximumHeightReached();
            }



            if (onJumpEnd)
            {
                onJumpEnd = false;
                letter.OnJumpEnded();
            }

            if (doSmallJump)
            {
                doSmallJump = false;
                letter.DoSmallJump();
            }

            if (doDanceWin)
            {
                doDanceWin = false;
                letter.DoDancingWin();
            }

            if (doDanceLose)
            {
                doDanceLose = false;
                letter.DoDancingLose();
            }

            if (doTwirl)
            {
                doTwirl = false;
                letter.DoTwirl(() => { Debug.Log("BACK!"); });
            }

            if (doToggleDance)
            {
                doToggleDance = false;
                letter.ToggleDance();
            }
        }