コード例 #1
0
        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;
            }
        }
コード例 #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;
            }
        }
コード例 #3
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();
            }
        }