mirror of
https://github.com/thegatesbrowser/godot-multiplayer.git
synced 2025-09-01 09:25:44 -04:00
copy from thegates-jam repo
This commit is contained in:
parent
c1a7ad74e1
commit
1a335de566
523 changed files with 22408 additions and 0 deletions
31
voip/voip_user.gd
Normal file
31
voip/voip_user.gd
Normal file
|
@ -0,0 +1,31 @@
|
|||
extends AudioStreamPlayer3D
|
||||
class_name VoipUser
|
||||
|
||||
@export var offset: Vector3
|
||||
@export var volume_curve: Curve
|
||||
@export var user_data_events: UserDataEvents
|
||||
|
||||
var user_id: int
|
||||
var anchor: Node3D
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
user_data_events.user_volume_changed.connect(change_volume)
|
||||
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
if not is_instance_valid(anchor): return
|
||||
global_position = anchor.global_position + offset
|
||||
|
||||
|
||||
func set_user_id(id: int) -> void:
|
||||
user_id = id
|
||||
|
||||
|
||||
func set_anchor(_anchor: Node3D) -> void:
|
||||
anchor = _anchor
|
||||
|
||||
|
||||
func change_volume(id: int, volume: float) -> void:
|
||||
if id != user_id: return
|
||||
volume_db = linear_to_db(volume_curve.sample(volume))
|
Loading…
Add table
Add a link
Reference in a new issue