parent
468c574763
commit
92efe2e488
@ -6,12 +6,15 @@ export(int) var _player_follow_pill_level = 3
|
||||
|
||||
var _visibility: Area
|
||||
var _playerRef
|
||||
var _audioPlayer: AudioStreamPlayer3D
|
||||
|
||||
|
||||
func _ready():
|
||||
Logger.set_logger_level(Logger.LOG_LEVEL_FINE)
|
||||
_visibility = get_node(_visibility_path) as Area
|
||||
|
||||
_audioPlayer = get_node("AudioStreamPlayer3D") as AudioStreamPlayer3D
|
||||
|
||||
if _visibility:
|
||||
_visibility.connect("body_entered", self, "_on_body_entered_visibility")
|
||||
_visibility.connect("body_exited", self, "_on_body_exited_visibility")
|
||||
@ -34,10 +37,33 @@ func _process(_delta):
|
||||
|
||||
func _on_body_entered_visibility(body: PhysicsBody):
|
||||
#Logger.trace("Meldewesen seeing %s" % [body])
|
||||
|
||||
if body.is_in_group("Player"):
|
||||
Logger.info("Seeing player!")
|
||||
|
||||
_audioPlayer.stream = null
|
||||
var daytime = Daytime.get_time()
|
||||
# do your job
|
||||
if body.is_in_workzone():
|
||||
Logger.info("say do your job")
|
||||
_audioPlayer.stream = load("res://Resources/Audio/do-job.wav")
|
||||
# take your pills
|
||||
elif Pills.get_level() < Pills.get_max()*0.1:
|
||||
Logger.info("say take your pills")
|
||||
_audioPlayer.stream = load("res://Resources/Audio/take-pills.wav")
|
||||
# go to work
|
||||
elif daytime < Daytime.get_max()*0.3:
|
||||
Logger.info("say go to work")
|
||||
_audioPlayer.stream = load("res://Resources/Audio/to-work.wav")
|
||||
# go home
|
||||
elif daytime > Daytime.get_max()*0.6:
|
||||
Logger.info("say go home")
|
||||
_audioPlayer.stream = load("res://Resources/Audio/go-home.wav")
|
||||
|
||||
if _audioPlayer.stream != null:
|
||||
Logger.info("say play sound")
|
||||
_audioPlayer.play();
|
||||
#yield(audioplayer, "finished")
|
||||
|
||||
# check if player is in illegal area
|
||||
if _playerRef.Is_in_Illegal_Area():
|
||||
Logger.info("player is in illegal area - following!")
|
||||
|
File diff suppressed because one or more lines are too long
@ -32,12 +32,25 @@ var _vel = Vector3()
|
||||
var _is_sprinting : bool
|
||||
var _illegal_areas : int
|
||||
var _save_areas : int
|
||||
var _work_areas : int
|
||||
var _prev_look
|
||||
|
||||
# TODO: move to global
|
||||
var _inventory: Control
|
||||
|
||||
|
||||
func is_in_illegalzone ():
|
||||
return _illegal_areas > 0
|
||||
|
||||
|
||||
func is_in_savezone ():
|
||||
return _save_areas > 0
|
||||
|
||||
|
||||
func is_in_workzone ():
|
||||
return _work_areas > 0
|
||||
|
||||
|
||||
func _ready():
|
||||
# Assign child node variables
|
||||
_body = get_node(body_nodepath) as Spatial # = $Body
|
||||
@ -193,7 +206,6 @@ func _on_area_entered (area: Area):
|
||||
#remove_child(player)
|
||||
#player. queue_free()
|
||||
get_node("AudioStreamPlayer3D").play()
|
||||
|
||||
yield(get_node("AudioStreamPlayer3D"), "finished")
|
||||
_on_respawn() # TODO: also raise if Meldewesen is looking at player and pill level reaches treshold!
|
||||
elif area.is_in_group("Forbidden"):
|
||||
@ -202,6 +214,9 @@ func _on_area_entered (area: Area):
|
||||
elif area.is_in_group("Savehouse"):
|
||||
Logger.info("entering save area!")
|
||||
_save_areas += 1
|
||||
elif area.is_in_group("Workwork"):
|
||||
Logger.info("entering work area!")
|
||||
_work_areas += 1
|
||||
|
||||
|
||||
func _on_area_exited (area: Area):
|
||||
@ -211,6 +226,9 @@ func _on_area_exited (area: Area):
|
||||
elif area.is_in_group("Savehouse"):
|
||||
Logger.info("leaving save area!")
|
||||
_save_areas -= 1
|
||||
elif area.is_in_group("Workwork"):
|
||||
Logger.info("leaving work area!")
|
||||
_work_areas -= 1
|
||||
|
||||
|
||||
func _on_respawn ():
|
||||
|
BIN
Resources/Audio/do-job.wav
Normal file
BIN
Resources/Audio/do-job.wav
Normal file
Binary file not shown.
21
Resources/Audio/do-job.wav.import
Normal file
21
Resources/Audio/do-job.wav.import
Normal file
@ -0,0 +1,21 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamSample"
|
||||
path="res://.import/do-job.wav-43df1cc0e940e076a0d16a1f10561364.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Resources/Audio/do-job.wav"
|
||||
dest_files=[ "res://.import/do-job.wav-43df1cc0e940e076a0d16a1f10561364.sample" ]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=true
|
||||
edit/normalize=true
|
||||
edit/loop=false
|
||||
compress/mode=0
|
BIN
Resources/Audio/go-home.wav
Normal file
BIN
Resources/Audio/go-home.wav
Normal file
Binary file not shown.
21
Resources/Audio/go-home.wav.import
Normal file
21
Resources/Audio/go-home.wav.import
Normal file
@ -0,0 +1,21 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamSample"
|
||||
path="res://.import/go-home.wav-b95ef6ffb01db7d887c9c8215db4aeac.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Resources/Audio/go-home.wav"
|
||||
dest_files=[ "res://.import/go-home.wav-b95ef6ffb01db7d887c9c8215db4aeac.sample" ]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=true
|
||||
edit/normalize=true
|
||||
edit/loop=false
|
||||
compress/mode=0
|
BIN
Resources/Audio/take-pills.wav
Normal file
BIN
Resources/Audio/take-pills.wav
Normal file
Binary file not shown.
21
Resources/Audio/take-pills.wav.import
Normal file
21
Resources/Audio/take-pills.wav.import
Normal file
@ -0,0 +1,21 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamSample"
|
||||
path="res://.import/take-pills.wav-c53467c031bc41f1583c5df7c998da45.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Resources/Audio/take-pills.wav"
|
||||
dest_files=[ "res://.import/take-pills.wav-c53467c031bc41f1583c5df7c998da45.sample" ]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=true
|
||||
edit/normalize=true
|
||||
edit/loop=false
|
||||
compress/mode=0
|
BIN
Resources/Audio/to-work.wav
Normal file
BIN
Resources/Audio/to-work.wav
Normal file
Binary file not shown.
21
Resources/Audio/to-work.wav.import
Normal file
21
Resources/Audio/to-work.wav.import
Normal file
@ -0,0 +1,21 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamSample"
|
||||
path="res://.import/to-work.wav-651eff9c01a8a6733015d116b9be0020.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Resources/Audio/to-work.wav"
|
||||
dest_files=[ "res://.import/to-work.wav-651eff9c01a8a6733015d116b9be0020.sample" ]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=true
|
||||
edit/normalize=true
|
||||
edit/loop=false
|
||||
compress/mode=0
|
Loading…
x
Reference in New Issue
Block a user