コード例 #1
0
        public void TicklesLetter()
        {
            m_Tickle = true;
            m_LetterObjectView.SetState(LLAnimationStates.LL_tickling);

            ColorTickleConfiguration.Instance.Context.GetAudioManager().PlaySound(Sfx.LL_Laugh);
        }
コード例 #2
0
 private void SetIsJumping()
 {
     letterObjectView.SetState(LLAnimationStates.LL_still);
     shadow.transform.parent = null;
     jumpCoroutine           = Jump();
     StartCoroutine(jumpCoroutine);
 }
コード例 #3
0
        void Start()
        {
            IInputManager inputManager = MixedLettersConfiguration.Instance.Context.GetInputManager();

            inputManager.onPointerDown += OnPointerDown;
            inputManager.onPointerDrag += OnPointerDrag;
            inputManager.onPointerUp   += OnPointerUp;

            //cameraDistance = Vector3.Distance(Camera.main.transform.position, transform.position);

            letterObjectView.SetState(LLAnimationStates.LL_still);
            letterObjectView.SetState(LLAnimationStates.LL_limbless);
        }
コード例 #4
0
        private void LoseLife()
        {
            //--TODO maybe this can be better if the LL controller handles all the LL states rather than just the hits
            if (game.anturaController.anturaState != AnturaContollerState.BARKING) //if the life loss wasn't caused inside Antura disruption
            {
                game.anturaController.ForceAnturaToGoBack();                       //we tickled the letter, antura turn back
            }
            else                                                                   //if it was we need also to overwrite the LL tickling animation
            {
                m_LetterObjectView.SetState(LLAnimationStates.LL_walking);         //keep running in fear instead of tickling
            }
            //--

            m_Lives--;

            game.gameUI.SetLives(m_Lives);
        }
コード例 #5
0
        void Start()
        {
            LL.SetState(LLAnimationStates.LL_rocketing);

            LLParent = ragdoll.transform.parent;

            isFleeing          = false;
            characterIsMoving  = false;
            characterWayPoints = new List <Vector3>();

            GetComponent <Collider>().enabled = false;

            foreach (Collider _collider in rocket.GetComponentsInChildren <Collider>())
            {
                _collider.enabled = false;
            }
        }
コード例 #6
0
 public void Start()
 {
     cameraDistance = Mathf.Abs(Camera.main.transform.position.z - transform.position.z);
     baseRotation = transform.rotation.eulerAngles;
     keepSpinning = spinEnabled;
     LLPrefab.SetState(LLAnimationStates.LL_hanging);
     RandomizeSpin();
     //RandomizeAnimation();
 }
コード例 #7
0
        /// <summary>
        /// Move the object from the current position to the final destination withe the setted speed.
        /// </summary>
        /// <param name="v3Destination">The final world position</param>
        private void MoveTo(Vector3 v3Destination)
        {
            Vector3 _v3MaxMovement     = v3Destination - gameObject.transform.position;
            Vector3 _v3PartialMovement = _v3MaxMovement.normalized * m_fMovementSpeed * Time.deltaTime;

            if (_v3PartialMovement.sqrMagnitude >= _v3MaxMovement.sqrMagnitude) //if we reached the destination
            {
                //position on the destination
                //gameObject.transform.position = v3Destination;
                gameObject.transform.Translate(_v3MaxMovement, Space.World);
                m_bMovingToDestination = false;

                //change animation and play sound
                m_oLetter.SetWalkingSpeed(0);
                m_oLetter.SetState(m_eAnimationOnDestReached);
                //AudioManager.I.PlayLetter(m_oLetter.Data.Id);

                if (OnDestinationReached != null) //launch event
                {
                    OnDestinationReached();
                }
            }
            else   //make the progress for this frame
            {
                m_oLetter.SetWalkingSpeed(1);

                m_oLetter.SetState(m_eAnimationOnMoving);
                gameObject.transform.Translate(_v3PartialMovement, Space.World);

                if (_v3MaxMovement.sqrMagnitude == 0)
                {
                    gameObject.transform.rotation = Quaternion.RotateTowards(gameObject.transform.rotation, Quaternion.LookRotation(Vector3.back), m_fRotationSpeed * Time.deltaTime);
                }
                else
                {
                    gameObject.transform.rotation = Quaternion.RotateTowards(gameObject.transform.rotation, Quaternion.LookRotation(_v3MaxMovement), m_fRotationSpeed * Time.deltaTime);
                }

                //gameObject.transform.position += _v3PartialMovement;
                //m_bMovingToDestination = true;
            }
        }
コード例 #8
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();
        }
コード例 #9
0
        public void Reset(bool stopCO = true)
        {
            if (stopCO)
            {
                StopAllCoroutines();
            }
            rainbowJet.SetActive(false);

            if (game.gameActive)
            {
                status = LLStatus.None;
                LLController.Falling = false;
                LLController.SetState(LLAnimationStates.LL_still);
                gotSuitcase = false;
                LLController.transform.rotation = startingRotation;
                transform.position = startingPosition;

                fallOffX       = fallOffPoint.position.x;
                midPointX      = midPoint.position.x;
                passedMidPoint = false;

                turnAngle = facingCamera ? 180 : 0;
                gameObject.SetActive(true);

                gameObject.GetComponent <SphereCollider>().enabled = true; // enable feet collider
                bodyCollider.enabled = false;                              // disable body collider

                showLLMesh(true);
            }
        }
コード例 #10
0
 /// <summary>
 /// play animation passed by param
 /// </summary>
 /// <param name="_animation"> animation to play </param>
 public void PlayAnimation(LLAnimationStates _animation)
 {
     mLetter.SetState(_animation);
 }
コード例 #11
0
 void PlayAnimation()
 {
     letterObjectView.SetState(LLAnimationStates.LL_dancing);
 }
コード例 #12
0
 private void AnturaReachedLetter()
 {
     m_LetterObjectView.SetState(LLAnimationStates.LL_still);
     m_LetterObjectView.HasFear   = true;
     m_LetterObjectView.Crouching = true;
 }
コード例 #13
0
        public void PlayIdleAnimation()
        {
            letter.SetState(LLAnimationStates.LL_idle);

            livingLetterTransform.localPosition = normalPosition;
        }
コード例 #14
0
 void PlayIdleAnimation()
 {
     letterObject.SetState(LLAnimationStates.LL_idle);
 }
コード例 #15
0
        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();
            }
        }
コード例 #16
0
        private IEnumerator Walk_Coroutine(WalkParameters parameters)
        {
            isWalking = true;
            var from               = parameters.from;
            var to                 = parameters.to;
            var rotation           = parameters.rotation;
            var duration           = parameters.duration;
            var delay              = parameters.delay;
            var walkAnimation      = parameters.walkAnimation;
            var walkSpeed          = parameters.walkSpeed;
            var afterWalkAnimation = parameters.afterWalkAnimation;
            var afterWalkSpeed     = parameters.afterWalkSpeed;
            var speak              = parameters.speak;
            var rotateAfterWalk    = parameters.rotateAfterWalk;
            var afterWalkRotation  = parameters.afterWalkRotation;

            if (delay > 0)
            {
                yield return(new WaitForSeconds(delay));
            }

            transform.rotation = Quaternion.Euler(rotation);
            //animator.SetTrigger(walkAnimation);
            LLPrefab.SetState(walkAnimation);
            LLPrefab.SetWalkingSpeed(walkSpeed);

            var interpolant  = 0f;
            var lerpProgress = 0f;
            var lerpLength   = duration;

            while (lerpProgress < lerpLength)
            {
                transform.localPosition = Vector3.Lerp(from, to, interpolant);
                lerpProgress           += Time.deltaTime;
                interpolant             = lerpProgress / lerpLength;
                interpolant             = Mathf.Sin(interpolant * Mathf.PI * 0.5f);
                yield return(new WaitForFixedUpdate());
            }

            //animator.SetTrigger(afterWalkAnimation);
            LLPrefab.SetState(afterWalkAnimation);
            LLPrefab.SetWalkingSpeed(afterWalkSpeed);

            if (speak)
            {
                yield return(new WaitForSeconds(0.25f));

                // Dirty Hack to fix an audio synch bug
                while (MakeFriendsGame.Instance.IsIntroducingLetter)
                {
                    yield return(null);
                }

                MakeFriendsGame.Instance.IsIntroducingLetter = true;
                var audioSource = SpeakWord();
                while (!audioSource.IsLoaded)
                {
                    yield return(null);
                }

                while (audioSource.IsPlaying)
                {
                    yield return(null);
                }
                MakeFriendsGame.Instance.IsIntroducingLetter = false;
                yield return(new WaitForSeconds(0.25f));

                MakeFriendsGame.Instance.SpokenWords++;
            }

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

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

                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());
                }
            }
            isWalking = false;
        }
コード例 #17
0
 void Start()
 {
     LL.Init(AppManager.I.Teacher.GetAllTestLetterDataLL().GetRandom());
     LL.SetState(LLAnimationStates.LL_rocketing);
     LL.Horraying = true;
 }
コード例 #18
0
ファイル: MazeLL.cs プロジェクト: vgwb/Antura_arabic
 void Start()
 {
     letter = GetComponent <LivingLetterController>();
     letter.SetState(LLAnimationStates.LL_rocketing);
 }