]> Untitled Git - wolf-seeking-sheep.git/blob - addons/dialogic/Modules/HighlightPortrait/simple_highlight_portrait.gd
Updated export config options
[wolf-seeking-sheep.git] / addons / dialogic / Modules / HighlightPortrait / simple_highlight_portrait.gd
1 @tool
2 extends DialogicPortrait
3
4 @export_group('Main')
5 @export_file var image := ""
6
7 var unhighlighted_color := Color.DARK_GRAY
8 var _prev_z_index := 0
9
10 ## Load anything related to the given character and portrait
11 func _update_portrait(passed_character:DialogicCharacter, passed_portrait:String) -> void:
12         apply_character_and_portrait(passed_character, passed_portrait)
13
14         apply_texture($Portrait, image)
15
16
17 func _ready() -> void:
18         if not Engine.is_editor_hint():
19                 self.modulate = unhighlighted_color
20
21
22 func _should_do_portrait_update(_character: DialogicCharacter, _portrait: String) -> bool:
23     return true
24
25
26 func _highlight() -> void:
27         create_tween().tween_property(self, 'modulate', Color.WHITE, 0.15)
28         _prev_z_index = DialogicUtil.autoload().Portraits.get_character_info(character).get('z_index', 0)
29         DialogicUtil.autoload().Portraits.change_character_z_index(character, 99)
30
31
32 func _unhighlight() -> void:
33         create_tween().tween_property(self, 'modulate', unhighlighted_color, 0.15)
34         DialogicUtil.autoload().Portraits.change_character_z_index(character, _prev_z_index)