added nose for Meldewesen for easier debugging

set Min Pill level to 1 -> otherwise collisions seems to stop working
changed Meldewesen behavior: only "catch" player if is in forbidden Area, otherwise just following
This commit is contained in:
incredibleLeitman 2019-12-27 18:10:09 +01:00
parent f2dbcc91a5
commit 3cfd698276
7 changed files with 61 additions and 32 deletions

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=9 format=2]
[gd_scene load_steps=10 format=2]
[ext_resource path="res://Characters/Meldewesen/Meldewesen.gd" type="Script" id=1]
@ -9,6 +9,8 @@ top_radius = 0.8
top_radius = 0.8
bottom_radius = 0.001
[sub_resource type="PrismMesh" id=8]
[sub_resource type="CylinderShape" id=3]
[sub_resource type="SpatialMaterial" id=4]
@ -31,7 +33,6 @@ script = ExtResource( 1 )
_visibility_path = NodePath("Visibility")
[node name="Meshes" type="Spatial" parent="."]
editor/display_folded = true
[node name="TrueAppearance" type="MeshInstance" parent="Meshes"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0 )
@ -44,6 +45,12 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0 )
mesh = SubResource( 2 )
material/0 = null
[node name="MeshInstance" type="MeshInstance" parent="Meshes"]
transform = Transform( 0.1, 0, 0, 0, -4.37114e-009, 0.1, 0, -0.1, -4.37114e-009, 0, 1.8, -0.9 )
layers = 3
mesh = SubResource( 8 )
material/0 = null
[node name="Collider" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0 )
shape = SubResource( 3 )
@ -53,7 +60,8 @@ collision_layer = 4
collision_mask = 4
[node name="VisibilityCone" type="MeshInstance" parent="Visibility"]
transform = Transform( 1, 0, 0, 0, -4.37114e-008, 1, 0, -1, -4.37114e-008, 0, 2, -3 )
transform = Transform( 1, 0, 0, 0, 0, 1, 0, -1, 0, 0, 2, -3 )
layers = 3
mesh = SubResource( 5 )
material/0 = null

View File

@ -12,5 +12,5 @@ func _process(delta):
# Taking a pill
if Input.is_action_just_pressed("take_pill"):
Pills.take_pill()
Logger.info("Player took a pill; new level: %s" % [Pills.get_round_level()])
#Logger.info("Player took a pill, new level: %s" % [Pills.get_round_level()])
_animation.play("PillTaking")

View File

@ -27,10 +27,12 @@ var _lookCast: RayCast
var _animationWalk: AnimationPlayer
var _animationFadeOut: AnimationPlayer
var _labelInteract: Label
var _dir = Vector3();
var _vel = Vector3();
var _is_sprinting : bool;
var _prev_look;
var _dir = Vector3()
var _vel = Vector3()
var _is_sprinting : bool
var _is_in_illegal_area : bool
var _prev_look
# TODO: move to global
var _inventory: Control
@ -62,7 +64,8 @@ func _ready():
# setup collisions with Meldewesen
var area = get_node("InteractArea") as Area
assert(null != area)
area.connect("area_entered", self, "_on_interact_entered")
area.connect("area_entered", self, "_on_area_entered")
area.connect("area_exited", self, "_on_area_exited")
func _physics_process(delta):
@ -171,14 +174,10 @@ func _input(event):
# Prevent player from doing a purzelbaum
_camera.rotation_degrees.x = clamp(_camera.rotation_degrees.x, -70, 70)
func _on_interact_entered (area: Area):
func _on_area_entered (area: Area):
if area.is_in_group("Enemy"):
Logger.info("ermahgerd they touched :-o !")
if Pills.get_level() < Pills.get_max() * 0.5:
_reset_scene() # TODO: call per event -> also rais if Meldewesen is looking at player and pill level reaches treshold!
else:
get_node("AudioStreamPlayer3D").play()
if _is_in_illegal_area: # or Pills.get_level() == 0: #< Pills.get_max() * 0.5:
# TODO: check why this does not work as intended:
#var player = AudioStreamPlayer3D.new()
#var audio_file = "res://Resources/Audio/dino-eat.wav"
@ -188,6 +187,19 @@ func _on_interact_entered (area: Area):
#player.play()
#remove_child(player)
#player. queue_free()
get_node("AudioStreamPlayer3D").play()
yield(get_node("AudioStreamPlayer3D"), "finished")
_reset_scene() # TODO: call per event -> also raise if Meldewesen is looking at player and pill level reaches treshold!
elif area.is_in_group("Forbidden"):
Logger.info("entering forbidden area!")
_is_in_illegal_area = true
func _on_area_exited (area: Area):
if area.is_in_group("Forbidden"):
Logger.info("leaving forbidden area!")
_is_in_illegal_area = false
func _reset_scene ():

View File

@ -48,10 +48,8 @@ func _process(delta):
var direction: Vector3 = (current_goal - _get_body_position())
var direction_normalized: Vector3 = direction.normalized()
body.move_towards(direction_normalized * speed)
# Look towards that goal as well
body.look_towards(direction_normalized)
body.move_towards(direction_normalized * speed)
# Returns the point we should currently be moving towards
@ -62,17 +60,18 @@ func _get_current_goal():
if _current_nav_index < _current_nav_path.size() - 1:
# We still have points left in the current navigation -> use the next one
Logger.trace("Using next point of current navigation")
# TODO: using log levels/categories
#Logger.trace("Using next point of current navigation")
_current_nav_index += 1
else:
# We're done following the current navigation to the next path point
if _current_path_index < curve.get_point_count() - 1:
# We still have points left in the path -> use the next one and generate the navigation to it
Logger.trace("Generating navigation to the next path point")
#Logger.trace("Generating navigation to the next path point")
_current_path_index += 1
else:
# We're done following the path -> Go back to the start
Logger.trace("Returning to the start of the path")
#Logger.trace("Returning to the start of the path")
_current_nav_index = 0
_current_path_index = 0

View File

@ -2,8 +2,8 @@ extends Node
var _level: float setget _set_level, get_level
var _min: float = 0.0
var _max: float = 6.0
var _min: float = 1.0
var _max: float = 10.0
var _decrease_per_second: float = 0.2
var _pill_add_amount: float = 2.0

File diff suppressed because one or more lines are too long