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()
|
||||
{
|
||||
Debug.Log("START PRESSED");
|
||||
statusText.text = "Starting host...";
|
||||
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))
|
||||
{
|
||||
|
||||
NetworkObject nob = AssetDatabase.LoadAssetAtPath<NetworkObject>(path);
|
||||
if (nob != null)
|
||||
foundNobs.Add(nob);
|
||||
else
|
||||
UnityEngine.Debug.LogWarning("Last loading error with: " + path);
|
||||
}
|
||||
}
|
||||
//Specific folders.
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -7,7 +7,7 @@ TextureImporter:
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
@@ -54,7 +54,7 @@ TextureImporter:
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureType: 1
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
@@ -44,6 +45,26 @@ namespace _PROJECT.NewHandPresence
|
||||
|
||||
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()
|
||||
{
|
||||
if (_state == TutorialState.Initializing)
|
||||
@@ -177,29 +198,33 @@ namespace _PROJECT.NewHandPresence
|
||||
private void TryInitialize()
|
||||
{
|
||||
if (!CanInitialize()) return;
|
||||
if (null == initializationInfoCoroutine)
|
||||
{
|
||||
initializationInfoCoroutine = StartCoroutine(InitializationInfoCoroutine());
|
||||
}
|
||||
|
||||
_camera = Camera.main;
|
||||
|
||||
Debug.Log("Initializing tutorial");
|
||||
//Debug.Log("Initializing tutorial");
|
||||
|
||||
_leftHintController = leftHand.GetComponentInChildren<XRControllerHintController>();
|
||||
_rightHintController = rightHand.GetComponentInChildren<XRControllerHintController>();
|
||||
|
||||
Debug.Log($"Left hint controller: {_leftHintController}");
|
||||
Debug.Log($"Right hint controller: {_rightHintController}");
|
||||
initializationInfoStatus[TutorialInfoKey.LeftHintController] = null != _leftHintController;
|
||||
initializationInfoStatus[TutorialInfoKey.RightHintController] = null != _rightHintController;
|
||||
|
||||
_leftSmartHandPresence = leftHand.GetComponentInChildren<SmartHandPresence>();
|
||||
_rightSmartHandPresence = rightHand.GetComponentInChildren<SmartHandPresence>();
|
||||
|
||||
Debug.Log($"Left smart hand presence: {_leftSmartHandPresence}");
|
||||
Debug.Log($"Right smart hand presence: {_rightSmartHandPresence}");
|
||||
initializationInfoStatus[TutorialInfoKey.LeftSmartHandPresence] = null != _leftSmartHandPresence;
|
||||
initializationInfoStatus[TutorialInfoKey.RightSmartHandPresence] = null != _rightSmartHandPresence;
|
||||
|
||||
if (_leftHintController == null ||
|
||||
_rightHintController == null ||
|
||||
_leftSmartHandPresence == null ||
|
||||
_rightSmartHandPresence == null)
|
||||
{
|
||||
Debug.Log("Hint controller or smart hand presence is null");
|
||||
//Debug.Log("Hint controller or smart hand presence is null");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -216,6 +241,7 @@ namespace _PROJECT.NewHandPresence
|
||||
|
||||
UpdateState(_state.Next());
|
||||
Debug.Log("Tutorial initialized");
|
||||
StopCoroutine(initializationInfoCoroutine);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
public class PlayAnimationOnTrigger : MonoBehaviour
|
||||
{
|
||||
[SerializeField] public Animator animator; // Reference to the Animator component
|
||||
[SerializeField] public string animationName = "YourAnimation"; // Name of the animation to play
|
||||
public enum KnownAnimations
|
||||
{
|
||||
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)
|
||||
{
|
||||
@@ -15,15 +27,16 @@ public class PlayAnimationOnTrigger : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
|
||||
string animationNameString = animationNames[animationName];
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// Play the animation
|
||||
animator.Play(animationName, 0, 0f);
|
||||
Debug.Log("Playing animation: " + animationName);
|
||||
animator.Play(animationNameString, 0, 0f);
|
||||
Debug.Log("Playing animation: " + animationNameString);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,14 @@ namespace _PROJECT.Multiplayer.NewBow
|
||||
if (_notch == null)
|
||||
Debug.LogError("Notch not found");
|
||||
|
||||
//CreateArrowServer();
|
||||
}
|
||||
|
||||
public override void OnOwnershipServer(NetworkConnection prevOwner)
|
||||
{
|
||||
base.OnOwnershipServer(prevOwner);
|
||||
|
||||
if (Owner.IsValid)
|
||||
CreateArrowServer();
|
||||
}
|
||||
|
||||
|
||||
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