mirror of
https://port.numenaute.org/aleajactaest/khanat-client.git
synced 2024-11-25 16:46:22 +00:00
ADD ajout d'un effet trauma qui floute l'ecran lorsque la valeurd e trauma augmente.
This commit is contained in:
parent
7978318bf7
commit
59a76dc7c3
6 changed files with 45 additions and 11 deletions
17
assets/interfaces/fx/trauma_fx.shader
Normal file
17
assets/interfaces/fx/trauma_fx.shader
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
shader_type spatial;
|
||||||
|
render_mode unshaded, cull_disabled, blend_mix;
|
||||||
|
|
||||||
|
uniform float mist_level = 0.0;
|
||||||
|
uniform float blur_amount : hint_range(0, 5);
|
||||||
|
|
||||||
|
|
||||||
|
void vertex()
|
||||||
|
{
|
||||||
|
POSITION = vec4(VERTEX, 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void fragment()
|
||||||
|
{
|
||||||
|
ALBEDO = textureLod(SCREEN_TEXTURE, SCREEN_UV, 5.0*mist_level).rgb;
|
||||||
|
ALPHA = mist_level;
|
||||||
|
}
|
|
@ -71,6 +71,10 @@ func _process( delta ):
|
||||||
$water_fx.get_surface_material( 0 ).set_shader_param( "mist_level", 0.0 )
|
$water_fx.get_surface_material( 0 ).set_shader_param( "mist_level", 0.0 )
|
||||||
|
|
||||||
|
|
||||||
|
var trauma_value = ($game_ui/stats_window.get_content_child( "trauma" ).value / 6.0)
|
||||||
|
$trauma_fx.get_surface_material( 0 ).set_shader_param( "mist_level", trauma_value )
|
||||||
|
|
||||||
|
|
||||||
func load_player( filename ):
|
func load_player( filename ):
|
||||||
$creatures/player.load_creature( filename )
|
$creatures/player.load_creature( filename )
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
[gd_scene load_steps=21 format=2]
|
[gd_scene load_steps=23 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://scenes/player/player.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://scenes/player/player.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://scenes/decors/terrains/demo/demo.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://scenes/decors/terrains/demo/demo.tscn" type="PackedScene" id=2]
|
||||||
[ext_resource path="res://scenes/game/game.gd" type="Script" id=3]
|
[ext_resource path="res://scenes/game/game.gd" type="Script" id=3]
|
||||||
[ext_resource path="res://assets/decors/terrains/demo/water/water_fx.shader" type="Shader" id=4]
|
[ext_resource path="res://assets/interfaces/fx/trauma_fx.shader" type="Shader" id=4]
|
||||||
[ext_resource path="res://assets/sky/sky.shader" type="Shader" id=5]
|
[ext_resource path="res://assets/sky/sky.shader" type="Shader" id=5]
|
||||||
[ext_resource path="res://scenes/game/sky.gd" type="Script" id=6]
|
[ext_resource path="res://scenes/game/sky.gd" type="Script" id=6]
|
||||||
[ext_resource path="res://assets/mist/mist.shader" type="Shader" id=7]
|
[ext_resource path="res://assets/mist/mist.shader" type="Shader" id=7]
|
||||||
[ext_resource path="res://assets/interfaces/debug_window/debug_window.tscn" type="PackedScene" id=8]
|
[ext_resource path="res://assets/interfaces/debug_window/debug_window.tscn" type="PackedScene" id=8]
|
||||||
[ext_resource path="res://assets/interfaces/themes/khanat_theme.theme" type="Theme" id=9]
|
[ext_resource path="res://assets/interfaces/themes/khanat_theme.theme" type="Theme" id=9]
|
||||||
|
[ext_resource path="res://assets/decors/terrains/demo/water/water_fx.shader" type="Shader" id=10]
|
||||||
[ext_resource path="res://scenes/interfaces/game_menu/game_ui.tscn" type="PackedScene" id=11]
|
[ext_resource path="res://scenes/interfaces/game_menu/game_ui.tscn" type="PackedScene" id=11]
|
||||||
|
|
||||||
[sub_resource type="OpenSimplexNoise" id=1]
|
[sub_resource type="OpenSimplexNoise" id=1]
|
||||||
|
@ -24,8 +25,8 @@ noise = SubResource( 1 )
|
||||||
[sub_resource type="ShaderMaterial" id=3]
|
[sub_resource type="ShaderMaterial" id=3]
|
||||||
resource_local_to_scene = true
|
resource_local_to_scene = true
|
||||||
shader = ExtResource( 5 )
|
shader = ExtResource( 5 )
|
||||||
shader_param/iTime = 1086.03
|
shader_param/iTime = 996.784
|
||||||
shader_param/iFrame = 83264
|
shader_param/iFrame = 40980
|
||||||
shader_param/COVERAGE = 0.5
|
shader_param/COVERAGE = 0.5
|
||||||
shader_param/THICKNESS = 25.0
|
shader_param/THICKNESS = 25.0
|
||||||
shader_param/ABSORPTION = 1.031
|
shader_param/ABSORPTION = 1.031
|
||||||
|
@ -76,12 +77,17 @@ shader_param/mist_height = 0.0
|
||||||
shader_param/mist_distance = 25.0
|
shader_param/mist_distance = 25.0
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id=10]
|
[sub_resource type="ShaderMaterial" id=10]
|
||||||
shader = ExtResource( 4 )
|
shader = ExtResource( 10 )
|
||||||
shader_param/mist_level = 0.0
|
shader_param/mist_level = 0.0
|
||||||
shader_param/mist_color = Color( 0.0156863, 0.411765, 0.545098, 1 )
|
shader_param/mist_color = Color( 0.0156863, 0.411765, 0.545098, 1 )
|
||||||
shader_param/mist_height = 0.0
|
shader_param/mist_height = 0.0
|
||||||
shader_param/mist_distance = 5.0
|
shader_param/mist_distance = 5.0
|
||||||
|
|
||||||
|
[sub_resource type="ShaderMaterial" id=11]
|
||||||
|
shader = ExtResource( 4 )
|
||||||
|
shader_param/mist_level = 0.0
|
||||||
|
shader_param/blur_amount = null
|
||||||
|
|
||||||
[node name="game" type="Spatial"]
|
[node name="game" type="Spatial"]
|
||||||
script = ExtResource( 3 )
|
script = ExtResource( 3 )
|
||||||
|
|
||||||
|
@ -128,6 +134,12 @@ extra_cull_margin = 16384.0
|
||||||
mesh = SubResource( 8 )
|
mesh = SubResource( 8 )
|
||||||
material/0 = SubResource( 10 )
|
material/0 = SubResource( 10 )
|
||||||
|
|
||||||
|
[node name="trauma_fx" type="MeshInstance" parent="."]
|
||||||
|
cast_shadow = 0
|
||||||
|
extra_cull_margin = 16384.0
|
||||||
|
mesh = SubResource( 8 )
|
||||||
|
material/0 = SubResource( 11 )
|
||||||
|
|
||||||
[node name="game_ui" parent="." instance=ExtResource( 11 )]
|
[node name="game_ui" parent="." instance=ExtResource( 11 )]
|
||||||
|
|
||||||
[node name="debug_window" parent="." instance=ExtResource( 8 )]
|
[node name="debug_window" parent="." instance=ExtResource( 8 )]
|
||||||
|
|
|
@ -29,7 +29,9 @@ func set_trauma( value ):
|
||||||
|
|
||||||
|
|
||||||
func update_trauma():
|
func update_trauma():
|
||||||
$stats_window.get_content_child( "trauma" ).self_modulate.a = (($stats_window.get_content_child( "oubli" ).value+$stats_window.get_content_child( "douleur" ).value)/2)/6.0
|
var trauma_value = (($stats_window.get_content_child( "oubli" ).value+$stats_window.get_content_child( "douleur" ).value)/2)
|
||||||
|
$stats_window.get_content_child( "trauma" ).value = trauma_value
|
||||||
|
$stats_window.get_content_child( "trauma" ).self_modulate.a = trauma_value/6.0
|
||||||
|
|
||||||
func _on_douleur_value_changed(value):
|
func _on_douleur_value_changed(value):
|
||||||
$stats_window.get_content_child( "douleur" ).self_modulate.a = (value / 18.0) * (value / 18.0)
|
$stats_window.get_content_child( "douleur" ).self_modulate.a = (value / 18.0) * (value / 18.0)
|
||||||
|
|
|
@ -60,7 +60,6 @@ margin_right = 128.0
|
||||||
margin_bottom = 128.0
|
margin_bottom = 128.0
|
||||||
max_value = 6.0
|
max_value = 6.0
|
||||||
step = 0.5
|
step = 0.5
|
||||||
value = 6.0
|
|
||||||
texture_progress = ExtResource( 4 )
|
texture_progress = ExtResource( 4 )
|
||||||
fill_mode = 8
|
fill_mode = 8
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
|
|
|
@ -12,7 +12,7 @@ export var jump_impulse = 25
|
||||||
export(float, 0.1, 20.0, 0.1) var rotation_speed_factor: = 0.01
|
export(float, 0.1, 20.0, 0.1) var rotation_speed_factor: = 0.01
|
||||||
|
|
||||||
var velocity: = Vector3.ZERO
|
var velocity: = Vector3.ZERO
|
||||||
var is_sprinting = false
|
var _is_sprinting = false
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
# $camera.make_current()
|
# $camera.make_current()
|
||||||
|
@ -22,7 +22,7 @@ func _ready():
|
||||||
func _input( event ):
|
func _input( event ):
|
||||||
|
|
||||||
if event.is_action_pressed( "toggle_sprint" ):
|
if event.is_action_pressed( "toggle_sprint" ):
|
||||||
is_sprinting = not is_sprinting
|
self._is_sprinting = not self._is_sprinting
|
||||||
|
|
||||||
func _process( delta ):
|
func _process( delta ):
|
||||||
|
|
||||||
|
@ -111,8 +111,8 @@ func load_creature( filename ):
|
||||||
$model/ra/model/metarig/Skeleton/body.get_surface_material( 0 ).set_shader_param( "albedo", self.creature.color )
|
$model/ra/model/metarig/Skeleton/body.get_surface_material( 0 ).set_shader_param( "albedo", self.creature.color )
|
||||||
|
|
||||||
func is_sprinting():
|
func is_sprinting():
|
||||||
if (not self.is_sprinting and Input.is_action_pressed( "sprint" )) \
|
if (not self._is_sprinting and Input.is_action_pressed( "sprint" )) \
|
||||||
or (self.is_sprinting and not Input.is_action_pressed( "sprint" )) \
|
or (self._is_sprinting and not Input.is_action_pressed( "sprint" )) \
|
||||||
:
|
:
|
||||||
return true
|
return true
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Reference in a new issue