Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Assets/Gothic-Core/Scripts/Const/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ public static class Animations
public static LayerMask WaterLayer = LayerMask.NameToLayer("Water");
public static LayerMask UILayer = LayerMask.NameToLayer("UI");

// HVR Layers (could also be reused and implemented for XRIT if needed)
public static LayerMask PlayerLayer = LayerMask.NameToLayer("Player"); // Layer 8 (suggested by HVR)
public static LayerMask DynamicPoseLayer = LayerMask.NameToLayer("DynamicPose"); // Layer 9 (suggested by HVR)
public static LayerMask GrabbableLayer = LayerMask.NameToLayer("Grabbable"); // Layer 20 (suggested by HVR)
public static LayerMask HandLayer = LayerMask.NameToLayer("Hand"); // Layer 21 (suggested by HVR)
// VR layers (used by the VR backend for player, hands and grabbables)
public static LayerMask PlayerLayer = LayerMask.NameToLayer("Player"); // Layer 8 (VR backend default)
public static LayerMask DynamicPoseLayer = LayerMask.NameToLayer("DynamicPose"); // Layer 9 (VR backend default)
public static LayerMask GrabbableLayer = LayerMask.NameToLayer("Grabbable"); // Layer 20 (VR backend default)
public static LayerMask HandLayer = LayerMask.NameToLayer("Hand"); // Layer 21 (VR backend default)

// Custom layers
public static LayerMask VobItemLayer = LayerMask.NameToLayer("VobItem");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ private static void SnapDigSpotToLoader(GameObject go)

/// <summary>
/// Child vobs are created inside their parent's GO without a VobLoader of their own. Their adapters
/// (VRVobContainer, HvrPhysicsChest, door lock picking, VRFocus) call
/// (VRVobContainer, chest lid physics, door lock picking, VRFocus) call
/// GetComponentInParent&lt;VobLoader&gt;() and got the PARENT's vob (often an unnamed zCVob) -
/// InvalidCastExceptions, "No door or container found for ><", doors/chests that don't work (G2 Xardas' tower).
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public void Init(string root, bool mountModFiles = false, IReadOnlyList<string>
_prefab = new(s =>
{
// Lookup is done in following places:
// 1. CONTEXT_NAME/Prefabs/... - overwrites lookup path below, used for specific prefabs, for current context (HVR, Flat, ...)
// 1. CONTEXT_NAME/Prefabs/... - overwrites lookup path below, used for specific prefabs, for current context (VR, Flat, ...)
// 2. Prefabs/... - Located inside core module (Gothic-Core), if we don't need special handling.
var contextPrefixPath = $"{_contextInteractionService.GetContextName()}/{s}";
return new[] { contextPrefixPath, s }.Select(Resources.Load<GameObject>)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class NpcHelperService
{
/// <summary>
/// Ranges are in meter.
/// FIXME - We should use PERC_ASSESSTALK range to leverage HVR's Grabbable hover and remote grab distance!
/// FIXME - We should use PERC_ASSESSTALK range to leverage the VR grab hover and remote grab distance!
/// </summary>
public readonly Dictionary<VmGothicEnums.PerceptionType, int> PerceptionRanges = new ();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class MobInteractionService
[Inject] private readonly NpcInventoryService _npcInventoryService;

/// <summary>
/// Doors use HVRPhysicsDoor and chests their lid physics - not the mob/trigger path.
/// Doors use VR hinge physics and chests their lid physics - not the mob/trigger path.
/// Beds are oCMobDoors too (BED*/BEDHIGH* visuals), but get used like other mobs (SLEEPABIT_S1).
/// </summary>
public bool ShouldHandleGrab(IVirtualObject vob)
Expand Down
2 changes: 1 addition & 1 deletion Assets/Gothic-Core/Scripts/Services/Vobs/VobService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ private void AddToMobInteractableList(VobContainer container)
switch (container.Vob.Type)
{
// case VirtualObjectType.oCMOB: // FIXME - Needed? e.g. IMovableObject
// oCMobDoor excluded: doors use HVRPhysicsDoor for VR interaction, not AI_UseMob.
// oCMobDoor excluded: doors use VR hinge physics for interaction, not AI_UseMob.
case VirtualObjectType.oCMobFire:
case VirtualObjectType.oCMobInter:
case VirtualObjectType.oCMobBed:
Expand Down
3 changes: 1 addition & 2 deletions Assets/Gothic-Lab/Scripts/Handler/LabFightHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using Gothic.Core.Services.Caches;
using Gothic.Core.Services.Npc;
using Gothic.Core.Extensions;
using HurricaneVR.Framework.Core.Utils;
using Reflex.Attributes;
using TMPro;
using UnityEngine;
Expand Down Expand Up @@ -60,7 +59,7 @@ public void MonsterDestroyClick()

private IEnumerator SpawnMonster(int amount, string instanceName = null)
{
if (instanceName.IsNullOrWhiteSpace())
if (string.IsNullOrWhiteSpace(instanceName))
instanceName = _monsterSelector.options[_monsterSelector.value].text;

while (amount-- > 0)
Expand Down
8 changes: 8 additions & 0 deletions Assets/Gothic-VR/Editor/Backends.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/Gothic-VR/Editor/Backends/Hvr.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using UnityEditor.Rendering.Universal;
using UnityEngine;

namespace Gothic.VR.Editor
namespace Gothic.VR.Editor.Backends.Hvr
{
public class HurricaneActions
{
Expand All @@ -24,6 +24,9 @@ private static void ConvertHVRMaterialToURP()

foreach (var folder in _hvrMaterialFolders)
{
if (!Directory.Exists(folder))
continue;

materialFiles.AddRange(Directory.GetFiles(folder, "*.mat"));
}

Expand Down
48 changes: 36 additions & 12 deletions Assets/Gothic-VR/Scripts/Adapters/Context/VRContextBootstrap.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
#if GOTHIC_HVR_INSTALLED
using System;
using Gothic.Core.Adapters.Context;
using Gothic.Core.Extensions;
using Gothic.Core.Logging;
using Gothic.Core.Models.Context;
using Gothic.Core.Services.Context;
using Gothic.VR.Interaction.Ports;
using Gothic.VR.Services.Context;
using Gothic.Core.Extensions;
using Reflex.Attributes;
using ZenKit;
using Logger = Gothic.Core.Logging.Logger;
#if GOTHIC_HVR_INSTALLED
using Gothic.VR.Interaction.Backends.Hvr;
#endif

namespace Gothic.VR.Adapters.Context
{
/// <summary>
/// Bootstrap class which will register listener to set this module as Active if GameSettings.Controls match.
/// Also selects the VR backend (interaction framework) which provides our VR ports.
/// </summary>
public class VRContextBootstrap : AbstractContextBootstrap
{
Expand All @@ -19,24 +26,42 @@ public class VRContextBootstrap : AbstractContextBootstrap
[Inject] private readonly ContextDialogService _contextDialogService;
[Inject] private readonly ContextTextInputService _contextTextInputService;

/// <summary>
/// Returns the VR backend compiled into this build, or null if none is available.
/// </summary>
public static IVrBackend SelectBackend()
{
#if GOTHIC_HVR_INSTALLED
return new HvrBackend();
#else
return null;
#endif
}

protected override void RegisterControlModule(Controls controls)
{
if (controls != Controls.VR)
return;

// We register VR only if we have HVR installed.
#if GOTHIC_HVR_INSTALLED
// We need to set our VR service now, as the Player.scene loading time (basically this Awake() call) is the first time,
// when we can set our VR service. But the [Inject] resolves are done already at frame 0 at Bootstrap.scene.
// Therefore, we need to set the VR service via new() and as proxy implementation.
var backend = SelectBackend();
if (backend == null)
{
const string message = "VR controls are set, but no VR backend is available. " +
"Set DeveloperConfig > Controls.GameControls = Flat, or install a VR backend " +
"(e.g. HVR, plus scripting define >GOTHIC_HVR_INSTALLED<).";
Logger.LogError(message, LogCat.VR);
throw new ArgumentException(message);
}

Logger.Log($"VR backend: {backend.Name}", LogCat.VR);

// We need to set our VR service now, as the Player.scene loading time (basically this Awake() call) is
// the first time, when we can set our VR service. But the [Inject] resolves are done already at frame 0
// at Bootstrap.scene. Therefore, we need to set the VR service via new() and as proxy implementation.
_contextInteractionService.SetImpl(new VRContextInteractionService());
_contextMenuService.SetImpl(new VRContextMenuService().Inject());
_contextDialogService.SetImpl(new VRContextDialogService().Inject());
_contextTextInputService.SetImpl(new VRContextTextInputService());
#else
throw new System.ArgumentException(
"VR context is set, but compiler directive >GOTHIC_HVR_INSTALLED< isn't set. Did you set up Hurricane VR properly?");
#endif
}

protected override void RegisterGameVersionModule(GameVersion version)
Expand All @@ -45,4 +70,3 @@ protected override void RegisterGameVersionModule(GameVersion version)
}
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if GOTHIC_HVR_INSTALLED
using Gothic.Core.Debugging.Fighting;

namespace Gothic.VR.Adapters.Debugging.Fighting
Expand All @@ -8,4 +7,3 @@ public class VrColliderHitTracker : ColliderHitTracker

}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if GOTHIC_HVR_INSTALLED
using Gothic.Core.Debugging.Fighting;

namespace Gothic.VR.Debugging.Fighting
Expand All @@ -8,4 +7,3 @@ public class VrNpcColliderDebugAdapter : NpcColliderDebugAdapter

}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if GOTHIC_HVR_INSTALLED
using System.Collections.Generic;
using Gothic.Core.Adapters.UI;
using Gothic.Core;
Expand Down Expand Up @@ -230,4 +229,3 @@ private GameObject CreateField(MarvinProperty<float> floatProperty, GameObject r
}
}
}
#endif
2 changes: 0 additions & 2 deletions Assets/Gothic-VR/Scripts/Adapters/Player/VRBackpack.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if GOTHIC_HVR_INSTALLED
using System.Collections;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -368,4 +367,3 @@ private void SubtractItemFromHand(List<ContentItem> inventory, GameObject handIt
}
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if GOTHIC_HVR_INSTALLED
using Gothic.Core.Const;
using Gothic.VR.Adapters.Vob.VobItem;

Expand All @@ -24,4 +23,3 @@ private void Start()
}
}
}
#endif
2 changes: 0 additions & 2 deletions Assets/Gothic-VR/Scripts/Adapters/Player/VRHandsOnTop.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if GOTHIC_HVR_INSTALLED
using Gothic.VR.Services;
using Reflex.Attributes;
using UnityEngine;
Expand Down Expand Up @@ -44,4 +43,3 @@ public void SetOnTop(bool onTop)
}
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if GOTHIC_HVR_INSTALLED
using System.Collections;
using Gothic.Core.Extensions;
using Gothic.Core.Manager;
Expand Down Expand Up @@ -71,4 +70,3 @@ private IEnumerator DisableDelayed(int milliseconds)
}
}
}
#endif
2 changes: 0 additions & 2 deletions Assets/Gothic-VR/Scripts/Adapters/Player/VRPlayer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if GOTHIC_HVR_INSTALLED
using Gothic.Core.Adapters.UI.Menus;
using Gothic.Core.Const;
using Gothic.Core.Services;
Expand Down Expand Up @@ -101,4 +100,3 @@ private bool IsGameScene()
}
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if GOTHIC_HVR_INSTALLED
using Gothic.Core.Manager;
using Gothic.VR.Interaction.Models;
using Gothic.VR.Interaction.Ports;
Expand Down Expand Up @@ -56,4 +55,3 @@ private void OnBeforeGrabbed(VrGrabArgs args)

}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if GOTHIC_HVR_INSTALLED
using System.Collections.Generic;
using Gothic.Core.Adapters.Vob;
using Gothic.Core.Extensions;
Expand Down Expand Up @@ -235,4 +234,3 @@ public IEnumerable<object> CollectMarvinInspectorProperties()
}
}
}
#endif
2 changes: 0 additions & 2 deletions Assets/Gothic-VR/Scripts/Adapters/Player/VRSeat.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if GOTHIC_HVR_INSTALLED
using System.Collections;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -147,4 +146,3 @@ private Transform GetNearestSnapPoint(Vector3 pos)
}
}
}
#endif
2 changes: 0 additions & 2 deletions Assets/Gothic-VR/Scripts/Adapters/Player/VRSpectatorCamera.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if GOTHIC_HVR_INSTALLED
using System;
using Gothic.Core;
using Gothic.Core.Logging;
Expand Down Expand Up @@ -147,4 +146,3 @@ private void SetRenderDistance(int value)
}
}
}
#endif
2 changes: 0 additions & 2 deletions Assets/Gothic-VR/Scripts/Adapters/Player/VRSwimDive.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if GOTHIC_HVR_INSTALLED
using System;
using System.Collections;
using System.Collections.Generic;
Expand Down Expand Up @@ -577,4 +576,3 @@ public IEnumerable<object> CollectMarvinInspectorProperties()
}
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if GOTHIC_HVR_INSTALLED
using Gothic.Core;
using Gothic.Core.Logging;
using Gothic.Core.Manager;
Expand Down Expand Up @@ -166,4 +165,3 @@ private void OnDestroy()
}
}
}
#endif
2 changes: 0 additions & 2 deletions Assets/Gothic-VR/Scripts/Adapters/SpeechToText/TextMatcher.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if GOTHIC_HVR_INSTALLED
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -91,4 +90,3 @@ public class MatchResult
public float Score { get; set; } // 0-1, where 1 is perfect match
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if GOTHIC_HVR_INSTALLED
using System;
using Gothic.Core.Adapters.UI.Menus;

Expand Down Expand Up @@ -42,4 +41,3 @@ protected override void ExecuteCommand(string itemName, string commandName)
}
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if GOTHIC_HVR_INSTALLED
using System;
using Gothic.Core.Adapters.UI.Menus;

Expand Down Expand Up @@ -42,4 +41,3 @@ protected override void ExecuteCommand(string itemName, string commandName)
}
}
}
#endif
2 changes: 0 additions & 2 deletions Assets/Gothic-VR/Scripts/Adapters/UI/Menus/TutorialHandler.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if GOTHIC_HVR_INSTALLED
using Gothic.Core.Services.Meshes;
using Gothic.Core.Services.Vm;
using Gothic.Core;
Expand Down Expand Up @@ -38,4 +37,3 @@ private void Start()
}
}
}
#endif
2 changes: 0 additions & 2 deletions Assets/Gothic-VR/Scripts/Adapters/UI/VRBillboard.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if GOTHIC_HVR_INSTALLED
using UnityEngine;

namespace Gothic.VR.Adapters.UI
Expand Down Expand Up @@ -30,4 +29,3 @@ private void Update()
}
}
}
#endif
2 changes: 0 additions & 2 deletions Assets/Gothic-VR/Scripts/Adapters/UI/VRCinema.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if GOTHIC_HVR_INSTALLED
using System.Collections.Generic;
using Gothic.Core;
using Gothic.Core.Adapters.Video;
Expand Down Expand Up @@ -275,4 +274,3 @@ private void UnlockPlayer()
}
}
}
#endif
Loading