コード例 #1
0
    public void Jump(Vector3 center)
    {
        if (state == "pan")
        {
            float newJumpVel = Random.Range(jumpVel - jumpVelRandomness, jumpVel + jumpVelRandomness);

            Vector2 toCenterDir = (center.ToVector2() * Random.Range(-0.1f, 1f) - transform.position.ToVector2()).normalized;



            if (isDed)
            {
                rb.velocity = rb.velocity.ToVector2().ToVector3() + Vector3.up * newJumpVel;
            }
            else
            {
                AudioManager.main.Play("tss");

                if (M.Change(60))
                {
                    AudioManager.main.Play("hit");
                }

                CameraShaker.Instance.ShakeOnce(1, 5, 0, 0.2f);

                rb.velocity = (toCenterDir * randomHorizontalVel).ToVector3() + Vector3.up * newJumpVel;

                ParticleManager.main.play(1, transform.position);

                GameManager.main.panSplasher.Play(transform.position);

                flasher.Flash();
            }
            eyeR.Blink();
            eyeL.Blink();

            rb.angularVelocity = Random.insideUnitSphere * randomAngularVel;

            health -= damagePerJump;

            CheckHealth();
        }
    }