Can this if statement be shortened? Only the operator differs.

Is it possible to make this shorter? The only difference is the plus and minus operator.

        if (playerIsOnTop != true)
        {
            material.color = new Color(color.r, color.g, color.b, color.a - (0.5f * Time.deltaTime));
        }

        if (playerIsOnTop == true)
        {
            material.color = new Color(color.r, color.g, color.b, color.a + (0.5f * Time.deltaTime));
        }

Float direction = playerIsOnTop ? 1 : -1;
material.color = new Color(color.r, color.g, color.b, color.a + ((0.5f * Time.deltaTime * direction));

Not tested, only on mobile :wink: