diff --git a/assets/props/book/materials/MAT_book.material b/assets/props/book/materials/MAT_book.material index e57288a..ebde256 100644 Binary files a/assets/props/book/materials/MAT_book.material and b/assets/props/book/materials/MAT_book.material differ diff --git a/assets/props/candle/sm_candle_a.mesh b/assets/props/candle/sm_candle_a.mesh index fa630de..8da6963 100644 Binary files a/assets/props/candle/sm_candle_a.mesh and b/assets/props/candle/sm_candle_a.mesh differ diff --git a/assets/props/candle/sm_candle_c.mesh b/assets/props/candle/sm_candle_c.mesh index 1b74b91..1fb1071 100644 Binary files a/assets/props/candle/sm_candle_c.mesh and b/assets/props/candle/sm_candle_c.mesh differ diff --git a/assets/props/candle/sm_candle_d.mesh b/assets/props/candle/sm_candle_d.mesh index b9e03a0..2263eba 100644 Binary files a/assets/props/candle/sm_candle_d.mesh and b/assets/props/candle/sm_candle_d.mesh differ diff --git a/assets/props/candle/sm_candle_top.mesh b/assets/props/candle/sm_candle_top.mesh index 871809e..40c719b 100644 Binary files a/assets/props/candle/sm_candle_top.mesh and b/assets/props/candle/sm_candle_top.mesh differ diff --git a/assets/props/dagger/materials/MA_dagger.material b/assets/props/dagger/materials/MA_dagger.material index 6509b19..35daab9 100644 Binary files a/assets/props/dagger/materials/MA_dagger.material and b/assets/props/dagger/materials/MA_dagger.material differ diff --git a/assets/props/dagger/textures/dagger_NM.tga.import b/assets/props/dagger/textures/dagger_NM.tga.import index 4f46e69..5de2230 100644 --- a/assets/props/dagger/textures/dagger_NM.tga.import +++ b/assets/props/dagger/textures/dagger_NM.tga.import @@ -2,26 +2,29 @@ importer="texture" type="StreamTexture" -path="res://.import/dagger_NM.tga-02457e4299815720542e6c6827c3099f.stex" +path.s3tc="res://.import/dagger_NM.tga-02457e4299815720542e6c6827c3099f.s3tc.stex" +path.etc2="res://.import/dagger_NM.tga-02457e4299815720542e6c6827c3099f.etc2.stex" +path.etc="res://.import/dagger_NM.tga-02457e4299815720542e6c6827c3099f.etc.stex" metadata={ -"vram_texture": false +"imported_formats": [ "s3tc", "etc2", "etc" ], +"vram_texture": true } [deps] source_file="res://assets/props/dagger/textures/dagger_NM.tga" -dest_files=[ "res://.import/dagger_NM.tga-02457e4299815720542e6c6827c3099f.stex" ] +dest_files=[ "res://.import/dagger_NM.tga-02457e4299815720542e6c6827c3099f.s3tc.stex", "res://.import/dagger_NM.tga-02457e4299815720542e6c6827c3099f.etc2.stex", "res://.import/dagger_NM.tga-02457e4299815720542e6c6827c3099f.etc.stex" ] [params] -compress/mode=0 +compress/mode=2 compress/lossy_quality=0.7 compress/hdr_mode=0 compress/bptc_ldr=0 -compress/normal_map=0 -flags/repeat=0 +compress/normal_map=1 +flags/repeat=true flags/filter=true -flags/mipmaps=false +flags/mipmaps=true flags/anisotropic=false flags/srgb=2 process/fix_alpha_border=true @@ -30,5 +33,5 @@ process/HDR_as_SRGB=false process/invert_color=false stream=false size_limit=0 -detect_3d=true +detect_3d=false svg/scale=1.0 diff --git a/assets/props/godet/materials/godet.material b/assets/props/godet/materials/godet.material index 8a5bff8..4c62b82 100644 Binary files a/assets/props/godet/materials/godet.material and b/assets/props/godet/materials/godet.material differ diff --git a/assets/props/godet/sm_godet.mesh b/assets/props/godet/sm_godet.mesh index f9578bf..f4cd134 100644 Binary files a/assets/props/godet/sm_godet.mesh and b/assets/props/godet/sm_godet.mesh differ diff --git a/assets/props/growler/sm_growler.mesh b/assets/props/growler/sm_growler.mesh index 2310d74..281bbd7 100644 Binary files a/assets/props/growler/sm_growler.mesh and b/assets/props/growler/sm_growler.mesh differ diff --git a/assets/props/parchment/materials/PaperParchment.material b/assets/props/parchment/materials/PaperParchment.material index aba90ab..1857f5f 100644 Binary files a/assets/props/parchment/materials/PaperParchment.material and b/assets/props/parchment/materials/PaperParchment.material differ diff --git a/assets/props/parchment/sm_paper_parcment.mesh b/assets/props/parchment/sm_paper_parcment.mesh index ae3a799..62789cd 100644 Binary files a/assets/props/parchment/sm_paper_parcment.mesh and b/assets/props/parchment/sm_paper_parcment.mesh differ diff --git a/assets/props/parchment/sm_wood_parchment.mesh b/assets/props/parchment/sm_wood_parchment.mesh index 6422094..4d86334 100644 Binary files a/assets/props/parchment/sm_wood_parchment.mesh and b/assets/props/parchment/sm_wood_parchment.mesh differ diff --git a/assets/props/rock floor/sm_floor.mesh b/assets/props/rock floor/sm_floor.mesh index e0feee1..02a2c51 100644 Binary files a/assets/props/rock floor/sm_floor.mesh and b/assets/props/rock floor/sm_floor.mesh differ diff --git a/assets/props/stool b/sm_stool_b.mesh b/assets/props/stool b/sm_stool_b.mesh index aa15b1e..0513586 100644 Binary files a/assets/props/stool b/sm_stool_b.mesh and b/assets/props/stool b/sm_stool_b.mesh differ diff --git a/assets/props/table/sm_table.mesh b/assets/props/table/sm_table.mesh index 8031168..b539fc9 100644 Binary files a/assets/props/table/sm_table.mesh and b/assets/props/table/sm_table.mesh differ diff --git a/locales/en.po b/locales/en.po index b8c597f..e5284a2 100644 --- a/locales/en.po +++ b/locales/en.po @@ -35,3 +35,9 @@ msgstr "Lead Artist -- VAILLANT Aurélien" msgid "ABOUT_SOURCE_GAME" msgstr "Source code of game : https://dev.stilobique.com/Athena/game-source" + +msgid "SCENE_WARCRAFT_DIALOG_QUIT_TITLE" +msgstr "Exit ?" + +msgid "SCENE_WARCRAFT_DIALOG_QUIT_QUESTION" +msgstr "Are you sure to quit ?" diff --git a/locales/fr.po b/locales/fr.po index 9a3eaa9..ad25b42 100644 --- a/locales/fr.po +++ b/locales/fr.po @@ -34,3 +34,9 @@ msgstr "Lead Artist -- VAILLANT Aurélien" msgid "ABOUT_SOURCE_GAME" msgstr "Code source du jeux : https://dev.stilobique.com/Athena/game-source" + +msgid "SCENE_WARCRAFT_DIALOG_QUIT_TITLE" +msgstr "Quit ?" + +msgid "SCENE_WARCRAFT_DIALOG_QUIT_QUESTION" +msgstr "Voulez vous vraiement quitté ?" diff --git a/locales/model.pot b/locales/model.pot index 92e8c1e..cc02f60 100644 --- a/locales/model.pot +++ b/locales/model.pot @@ -35,3 +35,9 @@ msgstr "Lead Artist -- VAILLANT Aurélien" msgid "ABOUT_SOURCE_GAME" msgstr "Source code of game : https://dev.stilobique.com/Athena/game-source" + +msgid "SCENE_WARCRAFT_DIALOG_QUIT_TITLE" +msgstr "Exit ?" + +msgid "SCENE_WARCRAFT_DIALOG_QUIT_QUESTION" +msgstr "Are you sure to quit ?" diff --git a/scenes/Global.gd b/scenes/Global.gd index cdd1d8a..aaf685c 100644 --- a/scenes/Global.gd +++ b/scenes/Global.gd @@ -24,6 +24,11 @@ func goto_scene(path): wait_frames = 1 Loading.get_node("ColorRect/CenterContainer/VBoxContainer/ProgressBar").set_max(loader.get_stage_count()) +func gyroscope_enabled(): + if Input.get_gyroscope(): + return true + else: + return false func _process(_delta): print("[global#_process]") diff --git a/scenes/levels/warcraft/WarCraft.exr b/scenes/levels/warcraft/WarCraft.exr index 83b7c5e..6b8a228 100644 Binary files a/scenes/levels/warcraft/WarCraft.exr and b/scenes/levels/warcraft/WarCraft.exr differ diff --git a/scenes/levels/warcraft/WarCraft.exr.import b/scenes/levels/warcraft/WarCraft.exr.import index 5882df9..1a8f516 100644 --- a/scenes/levels/warcraft/WarCraft.exr.import +++ b/scenes/levels/warcraft/WarCraft.exr.import @@ -21,4 +21,4 @@ flags/filter=true flags/mipmaps=false flags/srgb=false slices/horizontal=1 -slices/vertical=1 +slices/vertical=4 diff --git a/scenes/levels/warcraft/WarCraft.gd b/scenes/levels/warcraft/WarCraft.gd index e16a279..c0ea296 100644 --- a/scenes/levels/warcraft/WarCraft.gd +++ b/scenes/levels/warcraft/WarCraft.gd @@ -1,6 +1,11 @@ extends Spatial -const time_max = 3000 # msec +const TIME_MAX = 3000 # msec +const GYROSCOPE_MAX_DIFF = 0.5 +const OFFSET_CAMERA_MAX = 0.12 +const OFFSET_STEP_CHANGE = 0.01 + +var gyroscope_value_old = Vector3(0, 0, 0) onready var meshes = { "dagger": { @@ -13,27 +18,95 @@ onready var meshes = { } func _ready(): - $Dialog/ConfirmEscape.set_title("Quit ?") - $Dialog/ConfirmEscape.set_text("Voulez vous vraiment quitté ?") + $Dialog/ConfirmEscape.set_title(tr("SCENE_WARCRAFT_DIALOG_QUIT_TITLE")) + $Dialog/ConfirmEscape.set_text(tr("SCENE_WARCRAFT_DIALOG_QUIT_QUESTION")) func _process(_delta): + _check_quit_scene() + _check_dissolve_mesh() + _check_change_angle_camera() + +func _check_quit_scene(): # Event key "escape" and "godot event" ui_end if Input.is_action_just_pressed("ui_end"): _confirm_before_quit() - + +func _check_dissolve_mesh(): # Event dissolve in object searched by gamer for mesh in meshes: if meshes[mesh]["lock"] == true and meshes[mesh]["mesh"] != null: if meshes[mesh]["tick_reference"] == null: meshes[mesh]["tick_reference"] = OS.get_ticks_msec() - if OS.get_ticks_msec() < meshes[mesh]["tick_reference"] + time_max: + if OS.get_ticks_msec() < meshes[mesh]["tick_reference"] + TIME_MAX: meshes[mesh]["value"] += 0.01 meshes[mesh]["mesh"].get_surface_material(0).set("shader_param/dissolve_amount", meshes[mesh]["value"]) else: meshes[mesh]["mesh"].call_deferred("free") meshes[mesh]["mesh"] = null +func _check_change_angle_camera(): + var camera = $"Main Camera" + var gyroscope = Input.get_gyroscope() + + if camera.h_offset >= -OFFSET_CAMERA_MAX: + if _action_pressed("ui_left") or _action_gyroscope("left", gyroscope): + print("[warcraft#_ready] move camera angle to left") + $"Main Camera".h_offset -= OFFSET_STEP_CHANGE + + if camera.h_offset <= OFFSET_CAMERA_MAX: + if _action_pressed("ui_right") or _action_gyroscope("right", gyroscope): + print("[warcraft#_ready] move camera angle to right") + $"Main Camera".h_offset += OFFSET_STEP_CHANGE + + if camera.v_offset >= -OFFSET_CAMERA_MAX: + if _action_pressed("ui_down") or _action_gyroscope("down", gyroscope): + print("[warcraft#_ready] move camera angle to down") + $"Main Camera".v_offset -= OFFSET_STEP_CHANGE + + if camera.v_offset <= OFFSET_CAMERA_MAX: + if _action_pressed("ui_up") or _action_gyroscope("up", gyroscope): + print("[warcraft#_ready] move camera angle to up") + $"Main Camera".v_offset += OFFSET_STEP_CHANGE + + gyroscope_value_old = gyroscope + +func _action_pressed(action): + return Input.is_action_pressed(action) + +func _action_gyroscope(action, gyroscope): + if Global.gyroscope_enabled(): + var expression = Expression.new() + + expression.parse("_gyroscope_changed_"+action+"(gyroscope)", ["gyroscope"]) + + if expression.execute([gyroscope], self): + return true + else: + return false + else: + return false + +func _gyroscope_changed_left(gyroscope): + return (gyroscope.abs().y - gyroscope_value_old.abs().y) > GYROSCOPE_MAX_DIFF and \ + gyroscope.y < gyroscope_value_old.y + +func _gyroscope_changed_right(gyroscope): + return (gyroscope.abs().y - gyroscope_value_old.abs().y) > GYROSCOPE_MAX_DIFF and \ + gyroscope.y > gyroscope_value_old.y + +func _gyroscope_changed_down(gyroscope): + return (gyroscope.abs().z - gyroscope_value_old.abs().z) > GYROSCOPE_MAX_DIFF and \ + gyroscope.z > gyroscope_value_old.z or \ + (gyroscope.abs().x - gyroscope_value_old.abs().x) > GYROSCOPE_MAX_DIFF and \ + gyroscope.x > gyroscope_value_old.x + +func _gyroscope_changed_up(gyroscope): + return (gyroscope.abs().z - gyroscope_value_old.abs().z) > GYROSCOPE_MAX_DIFF and \ + gyroscope.z < gyroscope_value_old.z or \ + (gyroscope.abs().x - gyroscope_value_old.abs().x) > GYROSCOPE_MAX_DIFF and \ + gyroscope.x < gyroscope_value_old.x + func _notification(what): # Notification for android back action if what == MainLoop.NOTIFICATION_WM_GO_BACK_REQUEST: @@ -47,7 +120,7 @@ func _quit_to_menu(): Global.goto_scene("res://scenes/main.tscn") # Event when user click/touch dagger -func _on_dagger_input_event(camera, event, click_position, click_normal, shape_idx): +func _on_dagger_input_event(_camera, event, _click_position, _click_normal, _shape_idx): _initialize_mesh_ref("dagger", event) func _initialize_mesh_ref(meshInstance, event): diff --git a/scenes/levels/warcraft/WarCraft.lmbake b/scenes/levels/warcraft/WarCraft.lmbake index 9032ebe..652aa92 100644 Binary files a/scenes/levels/warcraft/WarCraft.lmbake and b/scenes/levels/warcraft/WarCraft.lmbake differ diff --git a/scenes/levels/warcraft/WarCraft.tscn b/scenes/levels/warcraft/WarCraft.tscn index 4db017a..31a8f79 100644 --- a/scenes/levels/warcraft/WarCraft.tscn +++ b/scenes/levels/warcraft/WarCraft.tscn @@ -37,14 +37,14 @@ surfaces/0 = { "vertex_count": 66436 } -[sub_resource type="CapsuleShape" id=5] +[sub_resource type="CapsuleShape" id=3] -[sub_resource type="PanoramaSky" id=3] +[sub_resource type="PanoramaSky" id=4] panorama = ExtResource( 11 ) -[sub_resource type="Environment" id=4] +[sub_resource type="Environment" id=5] background_mode = 3 -background_sky = SubResource( 3 ) +background_sky = SubResource( 4 ) background_color = Color( 0.188235, 0.133333, 0.133333, 1 ) background_energy = 0.6 ambient_light_color = Color( 0.694118, 0.168627, 0.67451, 1 ) @@ -113,7 +113,7 @@ cell_center_y = false cell_center_z = false baked_meshes = [ SubResource( 2 ) ] data = { -"cells": PoolIntArray( 0, 0, 3, 65531, 0, 3, 65532, 0, 536870915, 65533, 0, 3, 65534, 0, 3, 65535, 0, 3, 0, 1, 3, 65531, 1, 3, 65532, 1, 3, 65533, 1, 3, 65534, 1, -536870909, 65535, 1, 3, 0, 2, -1610612733, 65531, 2, 3, 65532, 2, 3, 65533, 2, 3, 65534, 2, 3, 65535, 2, 3, 0, 65534, 3, 65531, 65534, -1073741821, 65532, 65534, -1610612733, 65533, 65534, 3, 65534, 65534, 3, 65535, 65534, -1610612733, 0, 65535, 3, 65531, 65535, 3, 65532, 65535, -1610612733, 65533, 65535, 3, 65534, 65535, 536870915, 65535, 65535, 3 ) +"cells": PoolIntArray( 0, 0, 3, 65531, 0, 3, 65532, 0, 536870915, 65533, 0, 3, 65534, 0, 3, 65535, 0, 3, 0, 1, 3, 65531, 1, 3, 65532, 1, 3, 65533, 1, 3, 65534, 1, 3, 65535, 1, 3, 0, 2, 3, 65531, 2, 3, 65532, 2, -1610612733, 65533, 2, 3, 65534, 2, 3, 65535, 2, -1073741821, 0, 65534, 536870915, 65531, 65534, 3, 65532, 65534, 3, 65533, 65534, -1610612733, 65534, 65534, 3, 65535, 65534, -1073741821, 0, 65535, 3, 65531, 65535, 3, 65532, 65535, 3, 65533, 65535, 3, 65534, 65535, 3, 65535, 65535, 3 ) } __meta__ = { "_editor_clip_": 0, @@ -220,7 +220,7 @@ material/0 = ExtResource( 19 ) [node name="Area" type="Area" parent="Main Scene Props/dagger"] [node name="CollisionShape" type="CollisionShape" parent="Main Scene Props/dagger/Area"] -shape = SubResource( 5 ) +shape = SubResource( 3 ) [node name="sm_stool_b2" type="MeshInstance" parent="Main Scene Props"] transform = Transform( -0.232037, 0, -0.972707, 0, 1, 0, 0.972707, 0, -0.232037, -2.91873, 0.0130518, 0.702275 ) @@ -387,7 +387,7 @@ shadow_enabled = true shadow_contact = 0.3 [node name="WorldEnvironment" type="WorldEnvironment" parent="Lighting"] -environment = SubResource( 4 ) +environment = SubResource( 5 ) [node name="Dialog" type="Control" parent="."] margin_right = 40.0 diff --git a/scenes/main.gd b/scenes/main.gd index db48726..6902d50 100644 --- a/scenes/main.gd +++ b/scenes/main.gd @@ -3,7 +3,10 @@ extends Node export (PackedScene) var about = load("res://scenes/UI/About.tscn") export (PackedScene) var scenes = load("res://scenes/UI/ChooseScene.tscn") +const max_diff = 0.08 + var current_scene = null +var value_old = Vector2(0, 0) func _ready(): print(tr("MESSAGE_READY"))