khanat-client/scenes/player/player.gd
2020-03-24 19:48:58 +01:00

42 lines
1.8 KiB
GDScript

extends "res://ressources/scripts/entity.gd"
func _ready():
$model/ra/spring_arm/camera.make_current()
func load_creature( filename ):
var file = File.new()
if file.file_exists( "user://creatures/" + filename ):
file.open( "user://creatures/" + filename, File.READ )
var lines = ""
while not file.eof_reached():
var current_line = file.get_line()
lines += current_line
var json = JSON.parse( lines ).result
$model/ra/model/body.set( "blend_shapes/Boobs", str2var(json[ "female_boobs" ] ) )
$model/ra/model/body.set( "blend_shapes/Female_hip", str2var(json[ "female_hip" ] ) )
$model/ra/model/body.set( "blend_shapes/Male_Pack", str2var(json[ "male_pack" ] ) )
$model/ra/model/body.set( "blend_shapes/Male_Throat", str2var(json[ "male_throat" ] ) )
$model/ra/model/body.set( "blend_shapes/Pregnant", str2var(json[ "female_pregnant" ] ) )
$model/ra/model/body.set( "blend_shapes/Pregnant", str2var(json[ "female_pregnant" ] ) )
$model/ra/model/body.get_surface_material( 0 ).set_shader_param( "albedo", str2var( json[ "color" ] ) )
print( str2var( json[ "color" ] ) )
file.close()
func rotate_camera_arm( p_axis, p_angle_degree ):
$model/ra/spring_arm.rotate( p_axis, p_angle_degree )
func rotate_camera( p_axis, p_angle_degree ):
$model/ra/spring_arm/camera.rotate( p_axis, p_angle_degree )
func move_camera( p_translation ):
$model/ra/spring_arm/camera.translate( p_translation )
func reset_camera():
$model/ra/spring_arm.translation = Vector3( 0, 1.731, -1.74 )
$model/ra/spring_arm.rotation_degrees = Vector3( 0.0, 0.0, 0.0 )
$model/ra/spring_arm/camera.translation = Vector3( 0.0, 0.0, 0.0 )
$model/ra/spring_arm/camera.rotation_degrees = Vector3( -14, -178.1, 0.328 )