Beispiel #1
0
        private IEnumerator Jump()
        {
            yield return(new WaitForSeconds(Random.Range(0.4f, 1f)));

            for (;;)
            {
                velocity = new Vector3(0f, 30f, 0f);
                letterObjectView.DoSmallJump();
                var position = transform.position;
                yEquilibrium = position.y;
                transform.Translate(velocity * Time.fixedDeltaTime);

                isAirborne = true;

                while (transform.position.y > yEquilibrium)
                {
                    velocity.y += GRAVITY * 0.33f * Time.fixedDeltaTime;
                    transform.Translate(velocity * Time.fixedDeltaTime);
                    yield return(new WaitForFixedUpdate());
                }

                position.y         = yEquilibrium;
                transform.position = position;

                velocity   = Vector3.zero;
                isAirborne = false;

                letterObjectView.SetState(LLAnimationStates.LL_still);

                yield return(new WaitForSeconds(1.5f));
            }
        }
        IEnumerator co_FallOff()
        {
            gotSuitcase = false;
            status      = LLStatus.None;
            onStartFallOff(this);
            LLController.SetState(LLAnimationStates.LL_idle);
            LLController.DoSmallJump();
            StartCoroutine(RotateGO(livingLetter, new Vector3(90, 90, 0), 1f));
            yield return(new WaitForSeconds(0.25f));

            AudioManager.I.PlaySound(Sfx.LetterSad);
            yield return(new WaitForSeconds(0.25f));

            LLController.Falling = true;
            status = LLStatus.Falling;

            yield return(new WaitForSeconds(0.1f));

            LLController.Poof();
            showLLMesh(false);

            yield return(new WaitForSeconds(0.9f));

            onFallOff(this);
        }
Beispiel #3
0
        private IEnumerator LookTowardsAnturaCoroutine()
        {
            yield return(new WaitForSeconds(0.1f));

            letterObjectView.SetState(LLAnimationStates.LL_still);

            float targetAngle = 180 + 80 * (AnturaController.instance.LastEnteredFromTheLeft ? 1 : -1);

            float timeElapsed = 0;
            float sinFactor   = 2 * Mathf.PI * Mathf.Pow(LOOK_TOWARDS_ANTURA_TIME * 4, -1);

            while (timeElapsed < LOOK_TOWARDS_ANTURA_TIME)
            {
                transform.rotation = Quaternion.Euler(0, Mathf.Lerp(180, targetAngle, Mathf.Sin(sinFactor * timeElapsed)), 0);
                timeElapsed       += Time.fixedDeltaTime;
                yield return(new WaitForFixedUpdate());
            }

            letterObjectView.DoSmallJump();
        }
        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();
            }
        }