0.0.1
This commit is contained in:
commit
fadea22b9d
26 changed files with 741 additions and 0 deletions
21
entities/player_spawner.gd
Normal file
21
entities/player_spawner.gd
Normal file
|
@ -0,0 +1,21 @@
|
|||
class_name PlayerSpawner
|
||||
extends Node3D
|
||||
|
||||
const PLAYER_SCENE: PackedScene = preload("res://entities/player.tscn")
|
||||
|
||||
func _spawn_player(player: Dictionary) -> CharacterBody3D:
|
||||
var player_instance: Player = PLAYER_SCENE.instantiate()
|
||||
var id: int = player.id
|
||||
player_instance.position = position
|
||||
player_instance.hunter = player.hunter
|
||||
player_instance.set_multiplayer_authority(id)
|
||||
return player_instance
|
||||
|
||||
func _ready() -> void:
|
||||
if $MultiplayerSpawner is MultiplayerSpawner:
|
||||
($MultiplayerSpawner as MultiplayerSpawner).spawn_function = _spawn_player
|
||||
|
||||
func spawn_player(player: Dictionary) -> void:
|
||||
if $MultiplayerSpawner is MultiplayerSpawner:
|
||||
if ($MultiplayerSpawner as MultiplayerSpawner).spawn(player) == null:
|
||||
print("Failed to spawn player.")
|
Loading…
Add table
Add a link
Reference in a new issue