wip
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ParrelSync",
|
"name": "ParrelSync",
|
||||||
|
"rootNamespace": "",
|
||||||
"references": [],
|
"references": [],
|
||||||
"includePlatforms": [
|
"includePlatforms": [
|
||||||
"Editor"
|
"Editor"
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ MonoBehaviour:
|
|||||||
rigPrefab: {fileID: 75161255762383020, guid: 1ef3259331ddc1f4d94b628323ec45f3, type: 3}
|
rigPrefab: {fileID: 75161255762383020, guid: 1ef3259331ddc1f4d94b628323ec45f3, type: 3}
|
||||||
player: {fileID: 0}
|
player: {fileID: 0}
|
||||||
networkManager: {fileID: 0}
|
networkManager: {fileID: 0}
|
||||||
autoConnectOrHost: 0
|
autoConnectOrHost: 1
|
||||||
OnConnected:
|
OnConnected:
|
||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
m_Calls: []
|
m_Calls: []
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ MonoBehaviour:
|
|||||||
EnableNetworkLogs: 1
|
EnableNetworkLogs: 1
|
||||||
OldPrefabList: []
|
OldPrefabList: []
|
||||||
RunInBackground: 1
|
RunInBackground: 1
|
||||||
LogLevel: 1
|
LogLevel: 0
|
||||||
--- !u!114 &1446823875350840172
|
--- !u!114 &1446823875350840172
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ using Unity.Netcode.Components;
|
|||||||
using Unity.VisualScripting;
|
using Unity.VisualScripting;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Rendering.Universal;
|
using UnityEngine.Rendering.Universal;
|
||||||
|
using UnityEngine.UIElements;
|
||||||
using Zenject;
|
using Zenject;
|
||||||
|
|
||||||
public class PlayerComponent : NetworkBehaviour
|
public class PlayerComponent : NetworkBehaviour
|
||||||
@@ -51,7 +52,6 @@ public class PlayerComponent : NetworkBehaviour
|
|||||||
|
|
||||||
private bool isSoloRig => !networkObject.IsPlayerObject;
|
private bool isSoloRig => !networkObject.IsPlayerObject;
|
||||||
private bool isLocalRig => networkObject.IsLocalPlayer;
|
private bool isLocalRig => networkObject.IsLocalPlayer;
|
||||||
|
|
||||||
private bool isRemoteRig => !networkObject.IsOwner && networkObject.IsPlayerObject;
|
private bool isRemoteRig => !networkObject.IsOwner && networkObject.IsPlayerObject;
|
||||||
|
|
||||||
// Teleport information after player is loaded into scene
|
// Teleport information after player is loaded into scene
|
||||||
@@ -162,6 +162,13 @@ public class PlayerComponent : NetworkBehaviour
|
|||||||
|
|
||||||
public void Teleport(Vector3 position, Vector3 direction)
|
public void Teleport(Vector3 position, Vector3 direction)
|
||||||
{
|
{
|
||||||
|
StartCoroutine(TeleportAtTheEndOfFrame(position, direction));
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerator TeleportAtTheEndOfFrame(Vector3 position, Vector3 direction)
|
||||||
|
{
|
||||||
|
yield return new WaitForEndOfFrame();
|
||||||
|
|
||||||
if (isLoaded)
|
if (isLoaded)
|
||||||
{
|
{
|
||||||
teleporter.Teleport(position, direction);
|
teleporter.Teleport(position, direction);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using System.Collections;
|
|||||||
using Unity.Netcode;
|
using Unity.Netcode;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Zenject;
|
using Zenject;
|
||||||
using ParrelSync;
|
//using ParrelSync;
|
||||||
using UnityEngine.Events;
|
using UnityEngine.Events;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
@@ -45,14 +45,14 @@ public class GameManager : NetworkBehaviour
|
|||||||
|
|
||||||
if (autoConnectOrHost)
|
if (autoConnectOrHost)
|
||||||
{
|
{
|
||||||
if (ClonesManager.IsClone())
|
//if (ClonesManager.IsClone())
|
||||||
{
|
//{
|
||||||
JoinGame("");
|
// JoinGame("");
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
HostGame();
|
// HostGame();
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,13 +87,13 @@ public class GameManager : NetworkBehaviour
|
|||||||
private void OnClientStarted()
|
private void OnClientStarted()
|
||||||
{
|
{
|
||||||
OnConnected?.Invoke();
|
OnConnected?.Invoke();
|
||||||
OnClientsChanged.Invoke(networkManager.ConnectedClientsList);
|
//OnClientsChanged.Invoke(networkManager.ConnectedClientsList);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnClientStopped(bool wasHost)
|
private void OnClientStopped(bool wasHost)
|
||||||
{
|
{
|
||||||
OnDisconnected?.Invoke();
|
OnDisconnected?.Invoke();
|
||||||
OnClientsChanged.Invoke(networkManager.ConnectedClientsList);
|
//OnClientsChanged.Invoke(networkManager.ConnectedClientsList);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnClientConnectedCallback(ulong clientId)
|
private void OnClientConnectedCallback(ulong clientId)
|
||||||
@@ -124,10 +124,8 @@ public class GameManager : NetworkBehaviour
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Destroy(player.gameObject);
|
Destroy(player.gameObject);
|
||||||
yield return new WaitForEndOfFrame();
|
|
||||||
var playerObject = networkManager.LocalClient.PlayerObject;
|
var playerObject = networkManager.LocalClient.PlayerObject;
|
||||||
player = playerObject.GetComponent<PlayerComponent>();
|
player = playerObject.GetComponent<PlayerComponent>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
player.Teleport(position, rotation);
|
player.Teleport(position, rotation);
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public class HandMenuUI : NetworkBehaviour
|
|||||||
private GameObject settings;
|
private GameObject settings;
|
||||||
|
|
||||||
private float forwardOffset = 0.7f;
|
private float forwardOffset = 0.7f;
|
||||||
private float upOffset = -0.3f;
|
private float upOffset = -0.1f;
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,23 +2,23 @@ using UnityEditor;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
|
||||||
[ExecuteInEditMode]
|
//[ExecuteInEditMode]
|
||||||
public class LockToGrid : MonoBehaviour
|
//public class LockToGrid : MonoBehaviour
|
||||||
{
|
//{
|
||||||
public int tileSize = 1;
|
// public int tileSize = 1;
|
||||||
public Vector3 tileOffset = Vector3.zero;
|
// public Vector3 tileOffset = Vector3.zero;
|
||||||
|
|
||||||
void Update()
|
// void Update()
|
||||||
{
|
// {
|
||||||
if(!EditorApplication.isPlaying)
|
// if(!EditorApplication.isPlaying)
|
||||||
{
|
// {
|
||||||
Vector3 currentPosition = transform.position;
|
// Vector3 currentPosition = transform.position;
|
||||||
|
|
||||||
float snappedX = Mathf.Round(currentPosition.x / tileSize) * tileSize + tileOffset.x;
|
// float snappedX = Mathf.Round(currentPosition.x / tileSize) * tileSize + tileOffset.x;
|
||||||
float snappedZ = Mathf.Round(currentPosition.z / tileSize) * tileSize + tileOffset.z;
|
// float snappedZ = Mathf.Round(currentPosition.z / tileSize) * tileSize + tileOffset.z;
|
||||||
|
|
||||||
var snappedPosition = new Vector3(snappedX, currentPosition.y, snappedZ);
|
// var snappedPosition = new Vector3(snappedX, currentPosition.y, snappedZ);
|
||||||
transform.position = snappedPosition;
|
// transform.position = snappedPosition;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
@@ -143,8 +143,6 @@ PlayerSettings:
|
|||||||
preloadedAssets:
|
preloadedAssets:
|
||||||
- {fileID: 0}
|
- {fileID: 0}
|
||||||
- {fileID: 11400000, guid: 05da4dc3887e76b409ac8d96e5adcd52, type: 2}
|
- {fileID: 11400000, guid: 05da4dc3887e76b409ac8d96e5adcd52, type: 2}
|
||||||
- {fileID: -3242307658584684348, guid: 94ece74222127bf4487cc06019d68889, type: 2}
|
|
||||||
- {fileID: 11400000, guid: 5edd379c80a79174d9ef46693e5ef185, type: 2}
|
|
||||||
metroInputSource: 0
|
metroInputSource: 0
|
||||||
wsaTransparentSwapchain: 0
|
wsaTransparentSwapchain: 0
|
||||||
m_HolographicPauseOnTrackingLoss: 1
|
m_HolographicPauseOnTrackingLoss: 1
|
||||||
|
|||||||
Reference in New Issue
Block a user