コード例 #1
0
    // Jumping off of the Air Ride
    private IEnumerator JumpOffStar()
    {
        // Kirby no longer dependent on vehicle, and vice versa.
        airRide.transform.parent = null;
        airRide.gameObject.tag   = "AirMachine";
        ar.charge = 0;
        ar.resetRotation();
        ar         = null;
        onStar     = false;
        jumpCharge = 0;


        cam.transform.parent = null;
        cam.GetComponent <CameraControl> ().enabled = true;


        // Make all vehicle stats go back

        // Resetting particle effects for vehicles.
        if (jsp != null)
        {
            jsp.StopParticles();
            jsp = null;
        }
        if (sse != null)
        {
            sse.StopParticles();
            sse = null;
        }


        // Undo UI for vehicles
        ui.enabled = false;

        // Jumps Kirby Up, for a "Pop off" effect.
        rb.velocity += Vector3.up * moveSpeed * Time.deltaTime;

        // He isn't charging anymore, so appropriate the animations.
        anim.SetBool("Charging", false);
        anim.SetBool("JumpingOff", true);
        anim.SetBool("Jumping", false);
        anim.SetBool("Jumping2", false);
        anim.SetBool("Riding", false);

        // Don't re-enable his sphere collider for a few seconds so he won't instantly hop back on a ride.
        yield return(new WaitForSeconds(1f));

        sphereCol.enabled = true;
        anim.SetBool("JumpingOff", false);
    }