retrace/Characters/Player/PillCameras.gd
incredibleLeitman 0d37f1076d added fadeOut effect if get in touch with a meldewesen
only triggers for under 50 % Pill level, otherwise there will be an conversation
2019-12-14 15:32:29 +01:00

15 lines
457 B
GDScript

extends Spatial
var screen_texture: ColorRect
func _ready():
screen_texture = get_node("ScreenTextureView") as ColorRect
assert(null != screen_texture)
func _process(delta: float) -> void:
# The factor is 0 when the level is between 0% and 25%; 1 when the level is between 75% and 100%; lerp inbetween
var factor = clamp((Pills.get_level() / Pills.get_max() * 1.5 - 0.25), 0.0, 1.0)
screen_texture.material.set_shader_param("mask_factor", factor)