2020-03-21 09:10:26 +00:00
|
|
|
extends Spatial
|
|
|
|
|
|
|
|
var player_speed = 1.0
|
|
|
|
var player_rotation_speed = 0.1
|
|
|
|
|
|
|
|
var heightmap = null
|
|
|
|
|
2020-03-21 15:50:44 +00:00
|
|
|
func _ready():
|
|
|
|
if ProjectSettings.get_setting("khanat/debug_mode"):
|
|
|
|
$debug_window.popup()
|
2020-03-21 09:10:26 +00:00
|
|
|
# self.heightmap = Image.new()
|
|
|
|
# self.heightmap.load( "res://assets/decors/terrains/dunes_heightmap.png" )
|
|
|
|
#
|
|
|
|
|
|
|
|
func _input( event ):
|
|
|
|
var movment = Vector3( 0.0, 0.0, 0.0 )
|
|
|
|
var rotation = Vector3( 0.0, 0.0, 0.0 )
|
|
|
|
if event.is_action( "move_forward" ):
|
|
|
|
movment.z += self.player_speed
|
|
|
|
elif event.is_action( "move_backward" ):
|
|
|
|
movment.z -= self.player_speed
|
|
|
|
elif event.is_action( "move_left" ):
|
|
|
|
movment.x += self.player_speed
|
|
|
|
elif event.is_action( "move_right" ):
|
|
|
|
movment.x -= self.player_speed
|
|
|
|
|
|
|
|
if event.is_action( "turn_left" ):
|
|
|
|
rotation.y += self.player_rotation_speed
|
|
|
|
elif event.is_action( "turn_right" ):
|
|
|
|
rotation.y -= self.player_rotation_speed
|
2020-03-22 10:54:47 +00:00
|
|
|
|
2020-03-21 09:10:26 +00:00
|
|
|
$creatures/player.turn( rotation )
|
|
|
|
$creatures/player.move( movment )
|
|
|
|
|
|
|
|
|
|
|
|
func load_player( filename ):
|
|
|
|
$creatures/player.load_creature( filename )
|
|
|
|
|
2020-03-21 15:50:44 +00:00
|
|
|
|
|
|
|
func _on_debug_window_time_of_day_changed(value):
|
|
|
|
$sky/viewport/sky.set_day_time_hours(( value ))
|
|
|
|
|
|
|
|
|
|
|
|
func _on_debug_window_mist_level_changed(value):
|
|
|
|
$mist_fx.get_surface_material( 0 ).set_shader_param( "mist_level", value )
|
2020-03-22 16:04:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_debug_window_douleur_changed(value):
|
|
|
|
$game_ui.set_douleur( value )
|
2020-03-22 16:31:06 +00:00
|
|
|
self.update_debug_fears()
|
2020-03-22 16:04:01 +00:00
|
|
|
|
|
|
|
func _on_debug_window_oubli_changed(value):
|
|
|
|
$game_ui.set_oubli( value )
|
2020-03-22 16:31:06 +00:00
|
|
|
self.update_debug_fears()
|
2020-03-22 16:04:01 +00:00
|
|
|
|
|
|
|
func _on_debug_window_trauma_changed(value):
|
|
|
|
$game_ui.set_trauma( value )
|
2020-03-22 16:31:06 +00:00
|
|
|
self.update_debug_fears()
|
|
|
|
|
|
|
|
func update_debug_fears():
|
|
|
|
$debug_window.update_fears( $game_ui/stats_window/oubli.value, $game_ui/stats_window/douleur.value, $game_ui/stats_window/trauma.value )
|
|
|
|
|
|
|
|
|