meat_madness_redux/godot/assets/meat_bore/npcs/npc.gd

31 lines
800 B
sjkillen
GDScript

extends Spatial
class_name NPC
enum Name {Clark, Guy, Lee, Wally, Jackie, Alexis}
export(Name) var who
export var body_texture: StreamTexture
export var face_texture: StreamTexture
func is_male() -> bool:
return not (who == Name.Jackie or who == Name.Alexis)
func set_material():
var body_mesh: MeshInstance
if is_male():
body_mesh = $NPC_Male_Shared/Skeleton/NPC_Male
else:
body_mesh = $NPC_female/Skeleton/NPC_Female
var mat: SpatialMaterial = body_mesh.get_active_material(0).duplicate()
body_mesh.set_surface_material(0, mat)
mat.albedo_texture = body_texture
if not is_male():
var face_mat: SpatialMaterial = body_mesh.get_active_material(1).duplicate()
body_mesh.set_surface_material(1, face_mat)
face_mat.albedo_texture = face_texture
func _ready():
set_material()