Extensive work on VFX for the guild, assets for the world, and portrait variance. Work on quests. Extra work on User Flow completion and file saving.
This commit is contained in:
@@ -1 +1,41 @@
|
||||
extends Control
|
||||
class_name AdventurerPortrait extends Control
|
||||
|
||||
|
||||
var cv_lists : Array
|
||||
|
||||
func _ready() -> void:
|
||||
cv_lists = []
|
||||
cv_lists.resize(ColorVariant.Types.size())
|
||||
for i in range(len(cv_lists)):
|
||||
cv_lists[i] = []
|
||||
for child in get_children():
|
||||
if child is ColorVariant:
|
||||
cv_lists[child.type].append(child)
|
||||
|
||||
func set_appearance(appearance) -> void:
|
||||
set_color(ColorVariant.Types.HAIR, appearance.hair_color)
|
||||
set_color(ColorVariant.Types.SKIN, appearance.skin_color)
|
||||
set_color(ColorVariant.Types.EYES, appearance.eye_color)
|
||||
|
||||
static func random_color(type : ColorVariant.Types) -> String:
|
||||
var lst
|
||||
match(type):
|
||||
ColorVariant.Types.HAIR: lst = ColorVariant.hair_colors
|
||||
ColorVariant.Types.SKIN: lst = ColorVariant.skin_colors
|
||||
ColorVariant.Types.EYES: lst = ColorVariant.eye_colors
|
||||
var max = 0
|
||||
for opt in lst.keys():
|
||||
max += lst[opt].weight
|
||||
|
||||
var pick = randi_range(1, max)
|
||||
for opt in lst.keys():
|
||||
if lst[opt].weight == 0: #Zero weighted colors are special options.
|
||||
continue
|
||||
pick -= lst[opt].weight
|
||||
if pick < 0:
|
||||
return opt
|
||||
return "ERROR"
|
||||
|
||||
func set_color(type : ColorVariant.Types, color : String) -> void:
|
||||
for cv : ColorVariant in cv_lists[type]:
|
||||
cv.set_color(color)
|
||||
|
||||
Reference in New Issue
Block a user