Beispiel #1
0
    void Water_OnTriggerExit2DEvent(Collider2D collider)
    {
        // Create a splash where we exit the water
        SplashController.InstantiateSplash(this.transform.position);

        // Gravity has full effect now outside water
        this.gravityModifier = 1.0f;
    }
Beispiel #2
0
    void Water_OnTriggerEnter2DEvent(Collider2D collider)
    {
        // Create a splash where we enter the water
        SplashController.InstantiateSplash(this.transform.position);

        // When we hit the water, we interrupt our fall
        this.gravityModifier = GravityModifierInWater;

        // Slow us down initially as we enter water
        this.Controller2d.velocity.y *= 0.25f;
        this.Controller2d.velocity.x *= 0.25f;
    }