Compare commits
10 Commits
14c85c83a7
...
53c6b04d23
| Author | SHA1 | Date | |
|---|---|---|---|
| 53c6b04d23 | |||
| 91e44c5dae | |||
| 216e2660df | |||
| 57222f0bb0 | |||
| 768ed39abe | |||
| 89b9b5bd7a | |||
| 901334b6bf | |||
| 1885b1fbe8 | |||
| f81bc2f7fd | |||
| a4a6535779 |
@@ -81,6 +81,7 @@ public class NetworkMenuUI : MonoBehaviour
|
|||||||
}
|
}
|
||||||
private void OnStartPlaying()
|
private void OnStartPlaying()
|
||||||
{
|
{
|
||||||
|
Debug.Log("START PRESSED");
|
||||||
statusText.text = "Starting host...";
|
statusText.text = "Starting host...";
|
||||||
StartCoroutine(HostAndSearchRoutine());
|
StartCoroutine(HostAndSearchRoutine());
|
||||||
}
|
}
|
||||||
|
|||||||
23
Assets/FishNet.Config.XML
Normal file
23
Assets/FishNet.Config.XML
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ConfigurationData xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<Loaded>true</Loaded>
|
||||||
|
<PrefabGenerator>
|
||||||
|
<Enabled>true</Enabled>
|
||||||
|
<LogToConsole>true</LogToConsole>
|
||||||
|
<FullRebuild>false</FullRebuild>
|
||||||
|
<SaveChanges>true</SaveChanges>
|
||||||
|
<DefaultPrefabObjectsPath>Assets\DefaultPrefabObjects.asset</DefaultPrefabObjectsPath>
|
||||||
|
<SearchScope>1</SearchScope>
|
||||||
|
<ExcludedFolders />
|
||||||
|
<IncludedFolders>
|
||||||
|
<string>Assets\_PROJECT</string>
|
||||||
|
</IncludedFolders>
|
||||||
|
</PrefabGenerator>
|
||||||
|
<CodeStripping>
|
||||||
|
<IsBuilding>false</IsBuilding>
|
||||||
|
<IsDevelopment>false</IsDevelopment>
|
||||||
|
<IsHeadless>false</IsHeadless>
|
||||||
|
<StripReleaseBuilds>false</StripReleaseBuilds>
|
||||||
|
<StrippingType>0</StrippingType>
|
||||||
|
</CodeStripping>
|
||||||
|
</ConfigurationData>
|
||||||
7
Assets/FishNet.Config.XML.meta
Normal file
7
Assets/FishNet.Config.XML.meta
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fdec8b985bdf2364cac858b4136da794
|
||||||
|
TextScriptImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -319,9 +319,12 @@ namespace FishNet.Editing.PrefabCollectionGenerator
|
|||||||
{
|
{
|
||||||
foreach (string path in GetPrefabFiles("Assets", excludedPaths, true))
|
foreach (string path in GetPrefabFiles("Assets", excludedPaths, true))
|
||||||
{
|
{
|
||||||
|
|
||||||
NetworkObject nob = AssetDatabase.LoadAssetAtPath<NetworkObject>(path);
|
NetworkObject nob = AssetDatabase.LoadAssetAtPath<NetworkObject>(path);
|
||||||
if (nob != null)
|
if (nob != null)
|
||||||
foundNobs.Add(nob);
|
foundNobs.Add(nob);
|
||||||
|
else
|
||||||
|
UnityEngine.Debug.LogWarning("Last loading error with: " + path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Specific folders.
|
//Specific folders.
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -7,7 +7,7 @@ TextureImporter:
|
|||||||
mipmaps:
|
mipmaps:
|
||||||
mipMapMode: 0
|
mipMapMode: 0
|
||||||
enableMipMap: 1
|
enableMipMap: 1
|
||||||
sRGBTexture: 1
|
sRGBTexture: 0
|
||||||
linearTexture: 0
|
linearTexture: 0
|
||||||
fadeOut: 0
|
fadeOut: 0
|
||||||
borderMipMap: 0
|
borderMipMap: 0
|
||||||
@@ -54,7 +54,7 @@ TextureImporter:
|
|||||||
alphaUsage: 1
|
alphaUsage: 1
|
||||||
alphaIsTransparency: 0
|
alphaIsTransparency: 0
|
||||||
spriteTessellationDetail: -1
|
spriteTessellationDetail: -1
|
||||||
textureType: 0
|
textureType: 1
|
||||||
textureShape: 1
|
textureShape: 1
|
||||||
singleChannelComponent: 0
|
singleChannelComponent: 0
|
||||||
flipbookRows: 1
|
flipbookRows: 1
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.InputSystem;
|
using UnityEngine.InputSystem;
|
||||||
@@ -44,6 +45,26 @@ namespace _PROJECT.NewHandPresence
|
|||||||
|
|
||||||
private GameObject _billboard;
|
private GameObject _billboard;
|
||||||
|
|
||||||
|
public enum TutorialInfoKey
|
||||||
|
{
|
||||||
|
Initialized,
|
||||||
|
LeftHintController,
|
||||||
|
RightHintController,
|
||||||
|
LeftSmartHandPresence,
|
||||||
|
RightSmartHandPresence
|
||||||
|
}
|
||||||
|
protected Dictionary<TutorialInfoKey, bool> initializationInfoStatus = new Dictionary<TutorialInfoKey, bool>();
|
||||||
|
protected Coroutine initializationInfoCoroutine;
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
initializationInfoStatus.Add(TutorialInfoKey.Initialized, false);
|
||||||
|
initializationInfoStatus.Add(TutorialInfoKey.LeftHintController, false);
|
||||||
|
initializationInfoStatus.Add(TutorialInfoKey.RightHintController, false);
|
||||||
|
initializationInfoStatus.Add(TutorialInfoKey.LeftSmartHandPresence, false);
|
||||||
|
initializationInfoStatus.Add(TutorialInfoKey.RightSmartHandPresence, false);
|
||||||
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
if (_state == TutorialState.Initializing)
|
if (_state == TutorialState.Initializing)
|
||||||
@@ -177,29 +198,33 @@ namespace _PROJECT.NewHandPresence
|
|||||||
private void TryInitialize()
|
private void TryInitialize()
|
||||||
{
|
{
|
||||||
if (!CanInitialize()) return;
|
if (!CanInitialize()) return;
|
||||||
|
if (null == initializationInfoCoroutine)
|
||||||
|
{
|
||||||
|
initializationInfoCoroutine = StartCoroutine(InitializationInfoCoroutine());
|
||||||
|
}
|
||||||
|
|
||||||
_camera = Camera.main;
|
_camera = Camera.main;
|
||||||
|
|
||||||
Debug.Log("Initializing tutorial");
|
//Debug.Log("Initializing tutorial");
|
||||||
|
|
||||||
_leftHintController = leftHand.GetComponentInChildren<XRControllerHintController>();
|
_leftHintController = leftHand.GetComponentInChildren<XRControllerHintController>();
|
||||||
_rightHintController = rightHand.GetComponentInChildren<XRControllerHintController>();
|
_rightHintController = rightHand.GetComponentInChildren<XRControllerHintController>();
|
||||||
|
|
||||||
Debug.Log($"Left hint controller: {_leftHintController}");
|
initializationInfoStatus[TutorialInfoKey.LeftHintController] = null != _leftHintController;
|
||||||
Debug.Log($"Right hint controller: {_rightHintController}");
|
initializationInfoStatus[TutorialInfoKey.RightHintController] = null != _rightHintController;
|
||||||
|
|
||||||
_leftSmartHandPresence = leftHand.GetComponentInChildren<SmartHandPresence>();
|
_leftSmartHandPresence = leftHand.GetComponentInChildren<SmartHandPresence>();
|
||||||
_rightSmartHandPresence = rightHand.GetComponentInChildren<SmartHandPresence>();
|
_rightSmartHandPresence = rightHand.GetComponentInChildren<SmartHandPresence>();
|
||||||
|
|
||||||
Debug.Log($"Left smart hand presence: {_leftSmartHandPresence}");
|
initializationInfoStatus[TutorialInfoKey.LeftSmartHandPresence] = null != _leftSmartHandPresence;
|
||||||
Debug.Log($"Right smart hand presence: {_rightSmartHandPresence}");
|
initializationInfoStatus[TutorialInfoKey.RightSmartHandPresence] = null != _rightSmartHandPresence;
|
||||||
|
|
||||||
if (_leftHintController == null ||
|
if (_leftHintController == null ||
|
||||||
_rightHintController == null ||
|
_rightHintController == null ||
|
||||||
_leftSmartHandPresence == null ||
|
_leftSmartHandPresence == null ||
|
||||||
_rightSmartHandPresence == null)
|
_rightSmartHandPresence == null)
|
||||||
{
|
{
|
||||||
Debug.Log("Hint controller or smart hand presence is null");
|
//Debug.Log("Hint controller or smart hand presence is null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,6 +241,7 @@ namespace _PROJECT.NewHandPresence
|
|||||||
|
|
||||||
UpdateState(_state.Next());
|
UpdateState(_state.Next());
|
||||||
Debug.Log("Tutorial initialized");
|
Debug.Log("Tutorial initialized");
|
||||||
|
StopCoroutine(initializationInfoCoroutine);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnGripPerformed(SelectEnterEventArgs arg0)
|
private void OnGripPerformed(SelectEnterEventArgs arg0)
|
||||||
@@ -307,5 +333,35 @@ namespace _PROJECT.NewHandPresence
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IEnumerator InitializationInfoCoroutine()
|
||||||
|
{
|
||||||
|
string CombineMessage(TutorialInfoKey key, object value, string prefix)
|
||||||
|
{
|
||||||
|
bool isAvailable = initializationInfoStatus.GetValueOrDefault(key);
|
||||||
|
|
||||||
|
return prefix + ": " + (isAvailable ? value.ToString() : "NULL") + "\r\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isInitialized = initializationInfoStatus.GetValueOrDefault(TutorialInfoKey.Initialized);
|
||||||
|
while (!isInitialized)
|
||||||
|
{
|
||||||
|
isInitialized = initializationInfoStatus.GetValueOrDefault(TutorialInfoKey.Initialized);
|
||||||
|
|
||||||
|
string infoMessage = "Tutorial not yet initialized!" + "\r\n";
|
||||||
|
infoMessage += "(click me for more info)" + "\r\n";
|
||||||
|
infoMessage += "Hint controllers" + "\r\n";
|
||||||
|
infoMessage += CombineMessage(TutorialInfoKey.LeftHintController, _leftHintController, "Left");
|
||||||
|
infoMessage += CombineMessage(TutorialInfoKey.RightHintController, _rightHintController, "Right");
|
||||||
|
infoMessage += "Smart hand presence" + "\r\n";
|
||||||
|
infoMessage += CombineMessage(TutorialInfoKey.LeftSmartHandPresence, _leftSmartHandPresence, "Left");
|
||||||
|
infoMessage += CombineMessage(TutorialInfoKey.RightSmartHandPresence, _rightSmartHandPresence, "Right");
|
||||||
|
Debug.Log(infoMessage);
|
||||||
|
|
||||||
|
yield return new WaitForSeconds(7);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,22 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class PlayAnimationOnTrigger : MonoBehaviour
|
public class PlayAnimationOnTrigger : MonoBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField] public Animator animator; // Reference to the Animator component
|
public enum KnownAnimations
|
||||||
[SerializeField] public string animationName = "YourAnimation"; // Name of the animation to play
|
{
|
||||||
|
UFOFlight1
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Dictionary<KnownAnimations, string> animationNames = new Dictionary<KnownAnimations, string>();
|
||||||
|
|
||||||
|
[SerializeField] public Animator animator; // Reference to the Animator component
|
||||||
|
[SerializeField] public KnownAnimations animationName = KnownAnimations.UFOFlight1; // Name of the animation to play
|
||||||
|
|
||||||
|
protected void Awake()
|
||||||
|
{
|
||||||
|
animationNames[KnownAnimations.UFOFlight1] = "UFO group flight 1";
|
||||||
|
}
|
||||||
|
|
||||||
private void OnTriggerEnter(Collider other)
|
private void OnTriggerEnter(Collider other)
|
||||||
{
|
{
|
||||||
@@ -15,15 +27,16 @@ public class PlayAnimationOnTrigger : MonoBehaviour
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string animationNameString = animationNames[animationName];
|
||||||
|
|
||||||
// Check if the animation is already playing
|
// Check if the animation is already playing
|
||||||
if (animator.GetCurrentAnimatorStateInfo(0).IsName(animationName) && animator.GetCurrentAnimatorStateInfo(0).normalizedTime < 1)
|
if (animator.GetCurrentAnimatorStateInfo(0).IsName(animationNameString) && animator.GetCurrentAnimatorStateInfo(0).normalizedTime < 1)
|
||||||
{
|
{
|
||||||
Debug.Log("Animation is already playing.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Play the animation
|
// Play the animation
|
||||||
animator.Play(animationName, 0, 0f);
|
animator.Play(animationNameString, 0, 0f);
|
||||||
Debug.Log("Playing animation: " + animationName);
|
Debug.Log("Playing animation: " + animationNameString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,15 @@ namespace _PROJECT.Multiplayer.NewBow
|
|||||||
if (_notch == null)
|
if (_notch == null)
|
||||||
Debug.LogError("Notch not found");
|
Debug.LogError("Notch not found");
|
||||||
|
|
||||||
CreateArrowServer();
|
//CreateArrowServer();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnOwnershipServer(NetworkConnection prevOwner)
|
||||||
|
{
|
||||||
|
base.OnOwnershipServer(prevOwner);
|
||||||
|
|
||||||
|
if (Owner.IsValid)
|
||||||
|
CreateArrowServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnStartClient()
|
public override void OnStartClient()
|
||||||
|
|||||||
40
Assets/_PROJECT/Multiplayer/CustomNetworkManager.cs
Normal file
40
Assets/_PROJECT/Multiplayer/CustomNetworkManager.cs
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
using FishNet.Component.Spawning;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using Valve.Newtonsoft.Json.Converters;
|
||||||
|
using static UnityEditor.ShaderGraph.Internal.KeywordDependentCollection;
|
||||||
|
|
||||||
|
public class CustomNetworkManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
|
||||||
|
public static CustomNetworkManager instance = null;
|
||||||
|
|
||||||
|
public PlayerSpawner playerSpawner;
|
||||||
|
|
||||||
|
void Awake()
|
||||||
|
{
|
||||||
|
if (!instance) { instance = this; }
|
||||||
|
else if (instance != this) { Destroy(gameObject); }
|
||||||
|
|
||||||
|
DontDestroyOnLoad(gameObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
if (playerSpawner.Spawns.Length == 0) {
|
||||||
|
Debug.LogWarning("Player spawns undefined. Assign a player spawn to PlayerSpawner!");
|
||||||
|
} else {
|
||||||
|
bool hasSpawn = false;
|
||||||
|
foreach (Transform spawn in playerSpawner.Spawns)
|
||||||
|
{
|
||||||
|
hasSpawn |= spawn != null;
|
||||||
|
}
|
||||||
|
if (!hasSpawn)
|
||||||
|
{
|
||||||
|
Debug.LogWarning("Player spawns undefined. Assign a player spawn to PlayerSpawner!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
11
Assets/_PROJECT/Multiplayer/CustomNetworkManager.cs.meta
Normal file
11
Assets/_PROJECT/Multiplayer/CustomNetworkManager.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 067fc70e6bd1a024ba644f52017165fd
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
2212
Assets/_PROJECT/Multiplayer/Networking.prefab
Normal file
2212
Assets/_PROJECT/Multiplayer/Networking.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/_PROJECT/Multiplayer/Networking.prefab.meta
Normal file
7
Assets/_PROJECT/Multiplayer/Networking.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 67f163b4eb8c8df43b48aab810b8a0a8
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Binary file not shown.
Reference in New Issue
Block a user