Meldewesen can detect Player within visibility
This commit is contained in:
parent
c3301e15db
commit
72989b8438
@ -1,13 +1,28 @@
|
|||||||
extends KinematicBody
|
extends KinematicBody
|
||||||
|
|
||||||
# Declare member variables here. Examples:
|
|
||||||
# var a = 2
|
|
||||||
# var b = "text"
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
export(NodePath) var _visibility_path: NodePath
|
||||||
|
|
||||||
|
var _visibility: Area
|
||||||
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
pass # Replace with function body.
|
_visibility = get_node(_visibility_path) as Area
|
||||||
|
|
||||||
|
if _visibility:
|
||||||
|
_visibility.connect("body_entered", self, "_on_body_entered_visibility")
|
||||||
|
_visibility.connect("body_exited", self, "_on_body_exited_visibility")
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
#func _process(delta):
|
func _on_body_entered_visibility(body: Node):
|
||||||
# pass
|
if body.is_in_group("Player"):
|
||||||
|
print("Seeing player!")
|
||||||
|
# TODO: Check if the Player is in an area where they shouldn't be
|
||||||
|
|
||||||
|
# TODO: Follow the Player
|
||||||
|
|
||||||
|
|
||||||
|
func _on_body_exited_visibility(body: Node):
|
||||||
|
if body.is_in_group("Player"):
|
||||||
|
print("Stopped seeing player!")
|
||||||
|
# TODO: Stop following the Player
|
||||||
|
@ -26,6 +26,7 @@ points = PoolVector3Array( 0, 3, 4, 0.392069, 3, 3.98074, 0.780361, 3, 3.92314,
|
|||||||
|
|
||||||
[node name="Meldewesen" type="KinematicBody"]
|
[node name="Meldewesen" type="KinematicBody"]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
_visibility_path = NodePath("Visibility")
|
||||||
|
|
||||||
[node name="Meshes" type="Spatial" parent="."]
|
[node name="Meshes" type="Spatial" parent="."]
|
||||||
|
|
||||||
@ -56,5 +57,3 @@ material/0 = null
|
|||||||
[node name="CollisionShape" type="CollisionShape" parent="Visibility"]
|
[node name="CollisionShape" type="CollisionShape" parent="Visibility"]
|
||||||
transform = Transform( 1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 2, -3 )
|
transform = Transform( 1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 2, -3 )
|
||||||
shape = SubResource( 6 )
|
shape = SubResource( 6 )
|
||||||
|
|
||||||
[node name="Navigation" type="Navigation" parent="."]
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=7 format=2]
|
[gd_scene load_steps=9 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://Characters/Util/PathNavigatorForKinematicBody.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://Characters/Util/PathNavigatorForKinematicBody.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://Characters/Meldewesen/Meldewesen.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://Characters/Meldewesen/Meldewesen.tscn" type="PackedScene" id=2]
|
||||||
@ -13,6 +13,10 @@ polygons = [ PoolIntArray( 2, 0, 1 ), PoolIntArray( 7, 3, 6 ), PoolIntArray( 3,
|
|||||||
[sub_resource type="PlaneMesh" id=3]
|
[sub_resource type="PlaneMesh" id=3]
|
||||||
size = Vector2( 20, 20 )
|
size = Vector2( 20, 20 )
|
||||||
|
|
||||||
|
[sub_resource type="SphereShape" id=4]
|
||||||
|
|
||||||
|
[sub_resource type="SphereMesh" id=5]
|
||||||
|
|
||||||
[node name="Navigation" type="Navigation"]
|
[node name="Navigation" type="Navigation"]
|
||||||
|
|
||||||
[node name="Camera" type="Camera" parent="."]
|
[node name="Camera" type="Camera" parent="."]
|
||||||
@ -21,6 +25,7 @@ current = true
|
|||||||
|
|
||||||
[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 )
|
||||||
|
light_energy = 0.19
|
||||||
|
|
||||||
[node name="NavigationMeshInstance" type="NavigationMeshInstance" parent="."]
|
[node name="NavigationMeshInstance" type="NavigationMeshInstance" parent="."]
|
||||||
navmesh = SubResource( 1 )
|
navmesh = SubResource( 1 )
|
||||||
@ -46,3 +51,17 @@ body_nodepath = NodePath("Meldewesen")
|
|||||||
[node name="NodeGroupNotifier" parent="." instance=ExtResource( 3 )]
|
[node name="NodeGroupNotifier" parent="." instance=ExtResource( 3 )]
|
||||||
group_name = "Navigator"
|
group_name = "Navigator"
|
||||||
node_to_send = NodePath("..")
|
node_to_send = NodePath("..")
|
||||||
|
|
||||||
|
[node name="DummyPlayer" type="StaticBody" parent="." groups=[
|
||||||
|
"Player",
|
||||||
|
]]
|
||||||
|
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 5.65981, 1, 2 )
|
||||||
|
collision_layer = 5
|
||||||
|
collision_mask = 5
|
||||||
|
|
||||||
|
[node name="CollisionShape" type="CollisionShape" parent="DummyPlayer"]
|
||||||
|
shape = SubResource( 4 )
|
||||||
|
|
||||||
|
[node name="MeshInstance" type="MeshInstance" parent="DummyPlayer"]
|
||||||
|
mesh = SubResource( 5 )
|
||||||
|
material/0 = null
|
||||||
|
Loading…
x
Reference in New Issue
Block a user