This commit is contained in:
2025-06-26 21:27:54 +02:00
parent f8822831aa
commit 702b766981
8 changed files with 40 additions and 36 deletions

View File

@@ -11,6 +11,7 @@ using Unity.Netcode.Components;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.Rendering.Universal;
using UnityEngine.UIElements;
using Zenject;
public class PlayerComponent : NetworkBehaviour
@@ -51,7 +52,6 @@ public class PlayerComponent : NetworkBehaviour
private bool isSoloRig => !networkObject.IsPlayerObject;
private bool isLocalRig => networkObject.IsLocalPlayer;
private bool isRemoteRig => !networkObject.IsOwner && networkObject.IsPlayerObject;
// Teleport information after player is loaded into scene
@@ -162,6 +162,13 @@ public class PlayerComponent : NetworkBehaviour
public void Teleport(Vector3 position, Vector3 direction)
{
StartCoroutine(TeleportAtTheEndOfFrame(position, direction));
}
private IEnumerator TeleportAtTheEndOfFrame(Vector3 position, Vector3 direction)
{
yield return new WaitForEndOfFrame();
if (isLoaded)
{
teleporter.Teleport(position, direction);