2019-11-21 12:19:03 +01:00
|
|
|
extends Spatial
|
|
|
|
|
|
|
|
|
2019-12-14 15:32:29 +01:00
|
|
|
var screen_texture: ColorRect
|
|
|
|
|
|
|
|
|
|
|
|
func _ready():
|
|
|
|
screen_texture = get_node("ScreenTextureView") as ColorRect
|
|
|
|
assert(null != screen_texture)
|
2019-11-21 12:19:03 +01:00
|
|
|
|
|
|
|
|
|
|
|
func _process(delta: float) -> void:
|
2019-11-21 12:45:44 +01:00
|
|
|
# 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)
|
2019-11-21 12:36:41 +01:00
|
|
|
screen_texture.material.set_shader_param("mask_factor", factor)
|