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