28 lines
655 B
C#
28 lines
655 B
C#
using Sirenix.OdinInspector;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Unity.Netcode;
|
|
using UnityEngine;
|
|
using Zenject;
|
|
|
|
public class GameManager : NetworkBehaviour
|
|
{
|
|
[SerializeField]
|
|
[ReadOnly]
|
|
[Inject]
|
|
private PlayerComponent localPlayer;
|
|
public PlayerComponent LocalPlayer {
|
|
get { return localPlayer; }
|
|
}
|
|
|
|
public void PlayerSpawnedOnNetwork(PlayerComponent player)
|
|
{
|
|
if (player.IsLocalPlayer)
|
|
{
|
|
player.Teleport(localPlayer.Position, localPlayer.Rotation);
|
|
localPlayer.DestroyWithDependencies();
|
|
localPlayer = player;
|
|
}
|
|
}
|
|
}
|