added outline for interactions and key prompt
This commit is contained in:
parent
469f254644
commit
1024e9bc69
@ -3,6 +3,7 @@ extends KinematicBody
|
|||||||
# export variables
|
# export variables
|
||||||
export(NodePath) var body_nodepath
|
export(NodePath) var body_nodepath
|
||||||
export(NodePath) var lookingAt_nodepath
|
export(NodePath) var lookingAt_nodepath
|
||||||
|
export(NodePath) var ui_interact_nodepath
|
||||||
export(int) var keycard_lvl
|
export(int) var keycard_lvl
|
||||||
export(Array) var key_chain
|
export(Array) var key_chain
|
||||||
|
|
||||||
@ -23,6 +24,7 @@ var _lookCast: RayCast
|
|||||||
var _dir = Vector3();
|
var _dir = Vector3();
|
||||||
var _vel = Vector3();
|
var _vel = Vector3();
|
||||||
var _is_sprinting;
|
var _is_sprinting;
|
||||||
|
var _prev_look;
|
||||||
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
@ -39,7 +41,8 @@ func _physics_process(delta):
|
|||||||
process_input()
|
process_input()
|
||||||
process_movement(delta)
|
process_movement(delta)
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
check_interact()
|
||||||
|
|
||||||
func process_input():
|
func process_input():
|
||||||
# Walking
|
# Walking
|
||||||
@ -93,8 +96,31 @@ func process_movement(delta):
|
|||||||
func check_interact():
|
func check_interact():
|
||||||
if _lookCast.is_colliding():
|
if _lookCast.is_colliding():
|
||||||
var collider = _lookCast.get_collider()
|
var collider = _lookCast.get_collider()
|
||||||
if collider.is_in_group("Touchables") :
|
|
||||||
|
if collider.is_in_group("Touchables"):
|
||||||
|
#show interact tooltip
|
||||||
|
get_node(ui_interact_nodepath).show()
|
||||||
|
|
||||||
|
#enable outline of seen object
|
||||||
|
collider.get_node(collider.outline_path).show()
|
||||||
|
if _prev_look != null and is_instance_valid(_prev_look):
|
||||||
|
if _prev_look != collider:
|
||||||
|
_prev_look.get_node(_prev_look.outline_path).hide()
|
||||||
|
_prev_look = collider
|
||||||
|
|
||||||
|
#do interaction
|
||||||
|
if Input.is_action_just_pressed("interact"):
|
||||||
collider.do_interact(self)
|
collider.do_interact(self)
|
||||||
|
else:
|
||||||
|
#stop showing interact tooltip
|
||||||
|
get_node(ui_interact_nodepath).hide()
|
||||||
|
elif _prev_look != null and is_instance_valid(_prev_look):
|
||||||
|
#disable outline of last seen object
|
||||||
|
_prev_look.get_node(_prev_look.outline_path).hide()
|
||||||
|
_prev_look = null
|
||||||
|
|
||||||
|
#stop showing interact tooltip
|
||||||
|
get_node(ui_interact_nodepath).hide()
|
||||||
|
|
||||||
func _input(event):
|
func _input(event):
|
||||||
# capture mouse movement
|
# capture mouse movement
|
||||||
@ -105,8 +131,5 @@ func _input(event):
|
|||||||
var camera_rot = _body.rotation_degrees
|
var camera_rot = _body.rotation_degrees
|
||||||
camera_rot.x = clamp(camera_rot.x, -70, 70)
|
camera_rot.x = clamp(camera_rot.x, -70, 70)
|
||||||
_body.rotation_degrees = camera_rot
|
_body.rotation_degrees = camera_rot
|
||||||
|
|
||||||
if Input.is_action_just_pressed("interact"):
|
|
||||||
check_interact()
|
|
||||||
# interact with object player is looking at
|
# interact with object player is looking at
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ extents = Vector3( 10, 1, 10 )
|
|||||||
|
|
||||||
[node name="Player" parent="." instance=ExtResource( 1 )]
|
[node name="Player" parent="." instance=ExtResource( 1 )]
|
||||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.634059, 0.9426, 8.83401 )
|
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.634059, 0.9426, 8.83401 )
|
||||||
|
ui_interact_nodepath = NodePath("../UI/PressInteract")
|
||||||
|
|
||||||
[node name="DirectionalLight" type="DirectionalLight" parent="."]
|
[node name="DirectionalLight" type="DirectionalLight" parent="."]
|
||||||
transform = Transform( 0.766044, -0.582564, 0.271654, 0, 0.422618, 0.906308, -0.642788, -0.694272, 0.323744, 0, 5, 0 )
|
transform = Transform( 0.766044, -0.582564, 0.271654, 0, 0.422618, 0.906308, -0.642788, -0.694272, 0.323744, 0, 5, 0 )
|
||||||
@ -98,14 +99,26 @@ card_lvl = 1
|
|||||||
|
|
||||||
[node name="Door" parent="." instance=ExtResource( 7 )]
|
[node name="Door" parent="." instance=ExtResource( 7 )]
|
||||||
transform = Transform( -2.18557e-008, 0, 0.5, 0, 0.5, 0, -0.5, 0, -2.18557e-008, -10, 1, 10 )
|
transform = Transform( -2.18557e-008, 0, 0.5, 0, 0.5, 0, -0.5, 0, -2.18557e-008, -10, 1, 10 )
|
||||||
card_door = false
|
|
||||||
|
|
||||||
[node name="Door2" parent="." instance=ExtResource( 7 )]
|
[node name="Door2" parent="." instance=ExtResource( 7 )]
|
||||||
transform = Transform( -2.18557e-008, 0, 0.5, 0, 0.5, 0, -0.5, 0, -2.18557e-008, -10, 1, 8 )
|
transform = Transform( -2.18557e-008, 0, 0.5, 0, 0.5, 0, -0.5, 0, -2.18557e-008, -10, 1, 8 )
|
||||||
card_door = false
|
|
||||||
door_lvl = 1
|
door_lvl = 1
|
||||||
|
|
||||||
[node name="Door3" parent="." instance=ExtResource( 7 )]
|
[node name="Door3" parent="." instance=ExtResource( 7 )]
|
||||||
transform = Transform( -2.18557e-008, 0, 0.5, 0, 0.5, 0, -0.5, 0, -2.18557e-008, -10, 1, 6 )
|
transform = Transform( -2.18557e-008, 0, 0.5, 0, 0.5, 0, -0.5, 0, -2.18557e-008, -10, 1, 6 )
|
||||||
card_door = true
|
card_door = true
|
||||||
door_lvl = 1
|
door_lvl = 1
|
||||||
|
|
||||||
|
[node name="UI" type="Control" parent="."]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
|
||||||
|
[node name="PressInteract" type="Label" parent="UI"]
|
||||||
|
margin_left = 454.0
|
||||||
|
margin_top = 500.0
|
||||||
|
margin_right = 570.0
|
||||||
|
margin_bottom = 514.0
|
||||||
|
custom_colors/font_color = Color( 1, 1, 1, 1 )
|
||||||
|
custom_colors/font_outline_modulate = Color( 0, 0, 0, 1 )
|
||||||
|
custom_colors/font_color_shadow = Color( 0, 0, 0, 1 )
|
||||||
|
text = "Press E to interact"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
extends KinematicBody
|
extends KinematicBody
|
||||||
|
|
||||||
# export variables
|
# export variables
|
||||||
|
export(NodePath) var outline_path
|
||||||
export(bool) var card_door
|
export(bool) var card_door
|
||||||
export(int) var door_lvl
|
export(int) var door_lvl
|
||||||
|
|
||||||
|
@ -1,9 +1,23 @@
|
|||||||
[gd_scene load_steps=5 format=2]
|
[gd_scene load_steps=7 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Things/Door/Door.gd" type="Script" id=1]
|
[ext_resource path="res://Things/Door/Door.gd" type="Script" id=1]
|
||||||
|
[ext_resource path="res://Things/ReusableMaterials/Glow.tres" type="Material" id=2]
|
||||||
|
|
||||||
[sub_resource type="CubeMesh" id=1]
|
[sub_resource type="CubeMesh" id=1]
|
||||||
|
|
||||||
|
[sub_resource type="ArrayMesh" id=4]
|
||||||
|
surfaces/0 = {
|
||||||
|
"aabb": AABB( -1.05773, -1.05773, -1.05773, 2.11547, 2.11548, 2.11548 ),
|
||||||
|
"array_data": PoolByteArray( 220, 99, 135, 191, 220, 99, 135, 63, 220, 99, 135, 63, 0, 0, 127, 0, 127, 0, 0, 127, 0, 0, 0, 0, 220, 99, 135, 63, 220, 99, 135, 63, 220, 99, 135, 191, 0, 0, 129, 0, 129, 0, 0, 127, 85, 57, 0, 0, 220, 99, 135, 63, 220, 99, 135, 63, 220, 99, 135, 63, 0, 0, 127, 0, 127, 0, 0, 127, 85, 53, 0, 0, 220, 99, 135, 191, 220, 99, 135, 63, 220, 99, 135, 191, 0, 0, 129, 0, 129, 0, 0, 127, 0, 60, 0, 0, 220, 99, 135, 191, 220, 99, 135, 191, 220, 99, 135, 63, 0, 0, 127, 0, 127, 0, 0, 127, 0, 0, 0, 56, 220, 99, 135, 63, 220, 99, 135, 191, 220, 99, 135, 191, 0, 0, 129, 0, 129, 0, 0, 127, 85, 57, 0, 56, 220, 99, 135, 63, 220, 99, 135, 191, 220, 99, 135, 63, 0, 0, 127, 0, 127, 0, 0, 127, 85, 53, 0, 56, 220, 99, 135, 191, 220, 99, 135, 191, 220, 99, 135, 191, 0, 0, 129, 0, 129, 0, 0, 127, 0, 60, 0, 56, 220, 99, 135, 63, 220, 99, 135, 63, 220, 99, 135, 63, 127, 0, 0, 0, 0, 0, 129, 127, 85, 53, 0, 0, 220, 99, 135, 191, 220, 99, 135, 63, 220, 99, 135, 191, 129, 0, 0, 0, 0, 0, 127, 127, 0, 0, 0, 56, 220, 99, 135, 63, 220, 99, 135, 63, 220, 99, 135, 191, 127, 0, 0, 0, 0, 0, 129, 127, 85, 57, 0, 0, 220, 99, 135, 191, 220, 99, 135, 63, 220, 99, 135, 63, 129, 0, 0, 0, 0, 0, 127, 127, 85, 53, 0, 56, 220, 99, 135, 63, 220, 99, 135, 191, 220, 99, 135, 63, 127, 0, 0, 0, 0, 0, 129, 127, 85, 53, 0, 56, 220, 99, 135, 191, 220, 99, 135, 191, 220, 99, 135, 191, 129, 0, 0, 0, 0, 0, 127, 127, 0, 0, 0, 60, 220, 99, 135, 63, 220, 99, 135, 191, 220, 99, 135, 191, 127, 0, 0, 0, 0, 0, 129, 127, 85, 57, 0, 56, 220, 99, 135, 191, 220, 99, 135, 191, 220, 99, 135, 63, 129, 0, 0, 0, 0, 0, 127, 127, 85, 53, 0, 60, 220, 99, 135, 63, 220, 99, 135, 63, 220, 99, 135, 63, 0, 127, 0, 0, 129, 0, 0, 127, 85, 53, 0, 56, 220, 99, 135, 191, 220, 99, 135, 191, 220, 99, 135, 63, 0, 129, 0, 0, 127, 0, 0, 127, 85, 57, 0, 56, 220, 99, 135, 191, 220, 99, 135, 63, 220, 99, 135, 63, 0, 127, 0, 0, 129, 0, 0, 127, 85, 57, 0, 56, 220, 99, 135, 63, 220, 99, 135, 191, 220, 99, 135, 63, 0, 129, 0, 0, 127, 0, 0, 127, 0, 60, 0, 56, 220, 99, 135, 63, 220, 99, 135, 63, 220, 99, 135, 191, 0, 127, 0, 0, 129, 0, 0, 127, 85, 53, 0, 60, 220, 99, 135, 191, 220, 99, 135, 191, 220, 99, 135, 191, 0, 129, 0, 0, 127, 0, 0, 127, 85, 57, 0, 60, 220, 99, 135, 191, 220, 99, 135, 63, 220, 99, 135, 191, 0, 127, 0, 0, 129, 0, 0, 127, 85, 57, 0, 60, 220, 99, 135, 63, 220, 99, 135, 191, 220, 99, 135, 191, 0, 129, 0, 0, 127, 0, 0, 127, 0, 60, 0, 60 ),
|
||||||
|
"array_index_data": PoolByteArray( 0, 0, 4, 0, 2, 0, 2, 0, 4, 0, 6, 0, 1, 0, 5, 0, 3, 0, 3, 0, 5, 0, 7, 0, 8, 0, 12, 0, 10, 0, 10, 0, 12, 0, 14, 0, 9, 0, 13, 0, 11, 0, 11, 0, 13, 0, 15, 0, 16, 0, 20, 0, 18, 0, 18, 0, 20, 0, 22, 0, 17, 0, 21, 0, 19, 0, 19, 0, 21, 0, 23, 0 ),
|
||||||
|
"blend_shape_data": [ ],
|
||||||
|
"format": 97559,
|
||||||
|
"index_count": 36,
|
||||||
|
"primitive": 4,
|
||||||
|
"skeleton_aabb": [ ],
|
||||||
|
"vertex_count": 24
|
||||||
|
}
|
||||||
|
|
||||||
[sub_resource type="SphereMesh" id=2]
|
[sub_resource type="SphereMesh" id=2]
|
||||||
|
|
||||||
[sub_resource type="BoxShape" id=3]
|
[sub_resource type="BoxShape" id=3]
|
||||||
@ -12,12 +26,18 @@
|
|||||||
"Touchables",
|
"Touchables",
|
||||||
]]
|
]]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
outline_path = NodePath("DoorMesh/Outline")
|
||||||
|
|
||||||
[node name="DoorMesh" type="MeshInstance" parent="."]
|
[node name="DoorMesh" type="MeshInstance" parent="."]
|
||||||
transform = Transform( 1, 0, 0, 0, 2, 0, 0, 0, 0.1, 1, 0, 0 )
|
transform = Transform( 1, 0, 0, 0, 2, 0, 0, 0, 0.1, 1, 0, 0 )
|
||||||
mesh = SubResource( 1 )
|
mesh = SubResource( 1 )
|
||||||
material/0 = null
|
material/0 = null
|
||||||
|
|
||||||
|
[node name="Outline" type="MeshInstance" parent="DoorMesh"]
|
||||||
|
visible = false
|
||||||
|
mesh = SubResource( 4 )
|
||||||
|
material/0 = ExtResource( 2 )
|
||||||
|
|
||||||
[node name="KnobMesh" type="MeshInstance" parent="."]
|
[node name="KnobMesh" type="MeshInstance" parent="."]
|
||||||
transform = Transform( 0.12, 0, 0, 0, 0.12, 0, 0, 0, 0.12, 1.78, 0, 0.202 )
|
transform = Transform( 0.12, 0, 0, 0, 0.12, 0, 0, 0, 0.12, 1.78, 0, 0.202 )
|
||||||
mesh = SubResource( 2 )
|
mesh = SubResource( 2 )
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
extends StaticBody
|
extends StaticBody
|
||||||
|
|
||||||
# export variables
|
# export variables
|
||||||
|
export(NodePath) var outline_path
|
||||||
export(int) var key_id
|
export(int) var key_id
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,6 +1,7 @@
|
|||||||
extends StaticBody
|
extends StaticBody
|
||||||
|
|
||||||
# export variables
|
# export variables
|
||||||
|
export(NodePath) var outline_path
|
||||||
export(int) var card_lvl
|
export(int) var card_lvl
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
File diff suppressed because one or more lines are too long
4
Things/ReusableMaterials/Glow.tres
Normal file
4
Things/ReusableMaterials/Glow.tres
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
[gd_resource type="SpatialMaterial" format=2]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
albedo_color = Color( 1, 0.792157, 0.235294, 1 )
|
Loading…
x
Reference in New Issue
Block a user