예제 #1
0
    public void bounce(Rigidbody2D rigidbody)
    {
        if (bouncedRigidbodies.Contains(rigidbody))
        {
            return;
        }

        JumpPadBounceEvent newEvent = new JumpPadBounceEvent(this, rigidbody);

        newEvent.call();
        if (newEvent.isCancelled)
        {
            return;
        }

        bouncedRigidbodies.Add(rigidbody);
        rigidbody.AddForce(new Vector2(0, bounciness), ForceMode2D.Impulse);

        timer = FXTime;
        particleFX1.Play();
        particleFX2.Play();
        if (SFX)
        {
            SFX.Play();
        }
    }
    // #### EVENT ####
//	[CustomEventHandler()]
    void onJumpPadBounce(JumpPadBounceEvent cEvent)
    {
        Debug.Log("####JumpPadBounceEvent");
        if (cEvent.isCancelled)
        {
            return;
        }
        if (Input.GetKey(slide))
        {
            cEvent.isCancelled = true;
        }
    }