Rework island water and shop character
This commit is contained in:
parent
0d50c324e9
commit
352350157b
65 changed files with 1144 additions and 1120 deletions
|
|
@ -3,17 +3,25 @@ extends Area3D
|
|||
|
||||
signal local_player_range_changed(in_range: bool)
|
||||
|
||||
@export_node_path("Node3D") var look_character_path: NodePath = ^"../Shopkeeper"
|
||||
|
||||
var _local_player: Player
|
||||
var _local_player_in_range: bool = false
|
||||
var _look_character: WorldCharacterDisplay
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
_look_character = get_node_or_null(
|
||||
look_character_path
|
||||
) as WorldCharacterDisplay
|
||||
body_entered.connect(_on_body_entered)
|
||||
body_exited.connect(_on_body_exited)
|
||||
|
||||
|
||||
func setup_local_player(player: Player) -> void:
|
||||
_local_player = player
|
||||
if _look_character != null:
|
||||
_look_character.set_head_look_target(player)
|
||||
_refresh_overlaps()
|
||||
|
||||
|
||||
|
|
@ -29,6 +37,12 @@ func is_avatar_in_range(avatar: Player) -> bool:
|
|||
)
|
||||
|
||||
|
||||
func get_prompt_anchor_position() -> Vector3:
|
||||
if _look_character != null:
|
||||
return _look_character.get_head_anchor_position()
|
||||
return global_position + Vector3.UP * 1.25
|
||||
|
||||
|
||||
func _refresh_overlaps() -> void:
|
||||
var is_overlapping: bool = (
|
||||
_local_player != null
|
||||
|
|
@ -49,6 +63,8 @@ func _on_body_exited(body: Node3D) -> void:
|
|||
|
||||
|
||||
func _set_local_player_in_range(in_range: bool) -> void:
|
||||
if _look_character != null:
|
||||
_look_character.set_head_look_active(in_range)
|
||||
if _local_player_in_range == in_range:
|
||||
return
|
||||
_local_player_in_range = in_range
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue