10 Commits

Author SHA1 Message Date
53c6b04d23 Main scene changes. The scene tree is now more readable. Removed the two previous networking prefabs and added the new one. The only thing scene-dependent on it is the player's spawn point. Maybe also the object pool, however it seems to create one itself. So, the object pool in the scene might also be deleted perhaps. 2026-02-02 20:36:34 +02:00
91e44c5dae Created a single prefab to incorporate all the networking stuff. This is the only networking prefab required in the scene. We will see if git breaks it. 2026-02-02 20:35:25 +02:00
216e2660df Hide FMOD setup wizard by default. 2026-02-02 19:54:17 +02:00
57222f0bb0 The arrow server can only be created after the bow server's ownership is done. Should be tested. 2026-02-02 19:36:00 +02:00
768ed39abe Animation player refactoring. Also, if the animation is already playing, do not log. Might be dangerous, but was a bit spam for now. 2026-02-02 19:35:01 +02:00
89b9b5bd7a Scan only the project assets, not the entire folder, to build the Asset Database. 2026-02-02 19:32:32 +02:00
901334b6bf Fix for the Lexus normal map. 2026-02-02 19:30:25 +02:00
1885b1fbe8 Added some debug logs. 2026-02-02 19:29:49 +02:00
f81bc2f7fd The last Interaction Layer name must be "Teleport" not "Player Only". 2026-02-02 19:28:40 +02:00
a4a6535779 Reworked the TutorialController so that it will show the info about trying to initialize once per some time interval. Not flood the entire log. 2026-02-02 19:26:28 +02:00
15 changed files with 2402 additions and 65 deletions

View File

@@ -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
View 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>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: fdec8b985bdf2364cac858b4136da794
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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.

View File

@@ -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

View File

@@ -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);
}
}
} }
} }

View File

@@ -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);
} }
} }

View File

@@ -29,6 +29,14 @@ namespace _PROJECT.Multiplayer.NewBow
if (_notch == null) if (_notch == null)
Debug.LogError("Notch not found"); Debug.LogError("Notch not found");
//CreateArrowServer();
}
public override void OnOwnershipServer(NetworkConnection prevOwner)
{
base.OnOwnershipServer(prevOwner);
if (Owner.IsValid)
CreateArrowServer(); CreateArrowServer();
} }

View 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!");
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 067fc70e6bd1a024ba644f52017165fd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 67f163b4eb8c8df43b48aab810b8a0a8
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: