1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-06-24 12:32:29 +08:00

feat(多人游戏): 添加多人游戏生成器功能

- 在World场景中添加MultiplayerSpawner节点
- 在WorldManager中实现spawn方法处理本地和多人游戏生成逻辑
- 移除EntityBase中不再需要的多人游戏同步代码
This commit is contained in:
2025-11-14 06:45:54 +08:00
parent 12191f4233
commit 9e0b713ef7
3 changed files with 14 additions and 11 deletions
-11
View File
@@ -105,7 +105,6 @@ var currentStage: int = 0
var spawnTime: float = 0
func _ready():
multiplayer.multiplayer_peer = MultiplayerState.connection
if useStatic:
texture = texture.get_node("staticAnimation")
spawnTime = WorldManager.getTime()
@@ -181,13 +180,6 @@ func _physics_process(_delta: float) -> void:
storeEnergy(randf_range(0.01, 0.05 + fields.get(FieldStore.Entity.ENERGY_REGENERATION) - 1), true)
trailParticle.emitting = trailing
# 同步状态
@rpc("any_peer")
func syncPosition(player: String, newPosition: Vector2, newVelocity: Vector2):
if player != displayName: return
position = newPosition
velocity = newVelocity
# 通用方法
func rebuildWeaponIcons():
if isPlayer():
@@ -224,9 +216,6 @@ func move(direction: Vector2, isSprinting: bool = false):
var currentDirection = sign(direction.x)
if currentDirection != 0:
lastDirection = currentDirection
if MultiplayerState.isMultiplayer:
print("test")
syncPosition.rpc(displayName, position, velocity)
func getSprintInitialDisplace():
return displace(velocity) * sprintMultiplier
func getSprintProgress():