public void OnCollisionEnter(Collision collision)
        {
            if (collision.gameObject.tag == Constants.TAG_POKEBALL)
            {
                if (state == State.Chasing)
                {
                    BallController.instance.rigidBody.AddRelativeForce(new Vector3(Random.Range(-150f, 150f), 150f, Random.Range(-150f, 150f)));
                }

                else if (BallController.instance.IsIdle() && !ballGrabbed)
                {
                    animator.OnJumpGrab();
                    BallController.instance.OnIntercepted();
                    ballOffset  = new Vector3(Mathf.Sign(xVelocity) * 4f, 0f, 0f);
                    ballGrabbed = true;
                }
            }

            else if (collision.gameObject.tag == "Ground" && state == State.Falling)
            {
                state = State.Landed;

                animator.OnJumpEnded();
                animator.State = AnturaAnimationStates.walking;
            }
        }
Ejemplo n.º 2
0
        public void OnCollisionEnter(Collision collision)
        {
            if (collision.gameObject.tag == Constants.TAG_POKEBALL)
            {
                if (BallController.instance.IsIdle() && !ballGrabbed)
                {
                    animator.OnJumpGrab();
                    BallController.instance.OnIntercepted();
                    ballOffset  = new Vector3(Mathf.Sign(velocity.x) * 4f, 0f, 0f);
                    ballGrabbed = true;
                    Catapult.instance.DisableCollider();
                    BallController.instance.transform.DOPunchScale(-Vector3.one * 0.5f, 0.75f, 10, 0.1f);
                }
            }

            else if (collision.gameObject.tag == "Ground" && state == State.Falling)
            {
                state = State.Running;

                animator.OnJumpEnded();
                animator.State = AnturaAnimationStates.walking;

                velocity.y = 0f;
            }
        }
Ejemplo n.º 3
0
        public IEnumerator bark(float delay = 0)
        {
            antura.IsExcited = true;
            yield return(new WaitForSeconds(0.75f));

            antura.IsExcited = false;
            anturaAnimator.SetTrigger("doShout");
            AudioManager.I.PlaySfx(Sfx.DogBarking);
            yield return(new WaitForSeconds(2f));

            antura.OnJumpStart();
            yield return(new WaitForSeconds(0.5f));

            antura.OnJumpEnded();
            yield return(new WaitForSeconds(1.5f));

            if (SCARED_COUNTER > 2)
            {
                SCARED_COUNTER = 0;
                StartCoroutine(leaveScene());
            }

            else
            {
                yield return(new WaitForSeconds(1.5f));

                anturaAnimator.SetTrigger("doShout");
                AudioManager.I.PlaySfx(Sfx.DogBarking);
                yield return(new WaitForSeconds(2f));

                antura.DoBurp();
                AudioManager.I.PlaySfx(Sfx.DogBarking);
                yield return(new WaitForSeconds(0.5f));

                antura.IsAngry = true;

                yield return(new WaitForSeconds(2f));

                if (SCARED_COUNTER > 2)
                {
                    SCARED_COUNTER = 0;
                    StartCoroutine(leaveScene(true));
                }
                else
                {
                    charge();
                }
            }
            yield return(null);
        }
Ejemplo n.º 4
0
        void Update()
        {
            antura.IsAngry = angry;

            antura.SetWalkingSpeed(walkSpeed);

            if (doTransition)
            {
                doTransition = false;
                antura.State = targetState;
            }

            if (doBurp)
            {
                doBurp = false;
                antura.DoBurp();
            }

            if (doBite)
            {
                doBite = false;
                antura.DoBite();
            }

            if (doShout)
            {
                doShout = false;
                antura.DoShout();
            }


            if (doSniff)
            {
                doSniff = false;
                antura.DoSniff();
            }


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


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

            if (onJumpGrab)
            {
                onJumpGrab = false;
                antura.OnJumpGrab();
            }

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

            if (doCharge)
            {
                doCharge = false;
                antura.DoCharge(null);
            }

            if (doSpitOpen)
            {
                doSpitOpen = false;
                antura.DoSpit(true);
            }

            if (doSpitClosed)
            {
                doSpitClosed = false;
                antura.DoSpit(false);
            }

            if (onSlipStart)
            {
                onSlipStart = false;
                antura.OnSlipStarted();
            }

            if (onSlipEnd)
            {
                onSlipEnd = false;
                antura.OnSlipEnded();
            }
        }