mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-15 22:50:56 +00:00
GetPrefab and ShaderReplacer
This commit is contained in:
parent
02491121a4
commit
004a63152c
@ -70,7 +70,6 @@ namespace QSB.PlayerBodySetup.Remote
|
||||
|
||||
public static void ReplaceMaterials(Transform rootObject)
|
||||
{
|
||||
/*
|
||||
if (_materialDefinitions.Count == 0)
|
||||
{
|
||||
GenerateMaterialDefinitions();
|
||||
@ -83,7 +82,6 @@ namespace QSB.PlayerBodySetup.Remote
|
||||
ReplaceMaterials(renderer, materialName, replacementMaterial);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,20 @@ namespace QSB.PlayerBodySetup.Remote
|
||||
{
|
||||
public static class RemotePlayerCreation
|
||||
{
|
||||
private static GameObject _prefab;
|
||||
|
||||
private static GameObject GetPrefab()
|
||||
{
|
||||
if (_prefab != null)
|
||||
{
|
||||
return _prefab;
|
||||
}
|
||||
|
||||
_prefab = QSBCore.NetworkAssetBundle.LoadAsset<GameObject>("Assets/Prefabs/REMOTE_Player_Body.prefab");
|
||||
ShaderReplacer.ReplaceShaders(_prefab);
|
||||
return _prefab;
|
||||
}
|
||||
|
||||
public static Transform CreatePlayer(
|
||||
PlayerInfo player,
|
||||
out Transform visibleCameraRoot,
|
||||
@ -27,7 +41,7 @@ namespace QSB.PlayerBodySetup.Remote
|
||||
|
||||
// Variable naming convention is broken here to reflect OW unity project (with REMOTE_ prefixed) for readability
|
||||
|
||||
var REMOTE_Player_Body = Object.Instantiate(QSBCore.NetworkAssetBundle.LoadAsset<GameObject>("Assets/Prefabs/REMOTE_Player_Body.prefab"));
|
||||
var REMOTE_Player_Body = Object.Instantiate(GetPrefab());
|
||||
var REMOTE_PlayerCamera = REMOTE_Player_Body.transform.Find("REMOTE_PlayerCamera").gameObject;
|
||||
var REMOTE_RoastingSystem = REMOTE_Player_Body.transform.Find("REMOTE_RoastingSystem").gameObject;
|
||||
var REMOTE_Stick_Root = REMOTE_RoastingSystem.transform.Find("REMOTE_Stick_Root").gameObject;
|
||||
@ -41,8 +55,6 @@ namespace QSB.PlayerBodySetup.Remote
|
||||
|
||||
player.Body = REMOTE_Player_Body;
|
||||
|
||||
FixMaterialsInAllChildren.ReplaceMaterials(REMOTE_Player_Body.transform);
|
||||
|
||||
player.AnimationSync.InitRemote(REMOTE_Traveller_HEA_Player_v2.transform);
|
||||
|
||||
REMOTE_Player_Body.GetComponent<PlayerHUDMarker>().Init(player);
|
||||
|
13
QSB/PlayerBodySetup/Remote/ShaderReplacer.cs
Normal file
13
QSB/PlayerBodySetup/Remote/ShaderReplacer.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using QSB.Utility;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.PlayerBodySetup.Remote
|
||||
{
|
||||
public static class ShaderReplacer
|
||||
{
|
||||
public static void ReplaceShaders(GameObject prefab)
|
||||
{
|
||||
DebugLog.DebugWrite($"TODO: replace shaders for prefab {prefab}");
|
||||
}
|
||||
}
|
||||
}
|
@ -6,7 +6,7 @@ namespace QSB.Tools.FlashlightTool
|
||||
{
|
||||
internal static void CreateFlashlight(PlayerInfo player)
|
||||
{
|
||||
var REMOTE_FlashlightRoot = player.CameraBody.transform.Find("REMOTE_FlashlightRoot");
|
||||
var REMOTE_FlashlightRoot = player.CameraBody.transform.Find("REMOTE_FlashlightRoot").gameObject;
|
||||
|
||||
var qsbFlashlight = REMOTE_FlashlightRoot.GetComponent<QSBFlashlight>();
|
||||
qsbFlashlight.Player = player;
|
||||
|
@ -6,19 +6,31 @@ namespace QSB.Tools.ProbeTool
|
||||
{
|
||||
internal static class ProbeCreator
|
||||
{
|
||||
private static GameObject _prefab;
|
||||
|
||||
private static GameObject GetPrefab()
|
||||
{
|
||||
if (_prefab != null)
|
||||
{
|
||||
return _prefab;
|
||||
}
|
||||
|
||||
_prefab = QSBCore.NetworkAssetBundle.LoadAsset<GameObject>("Assets/Prefabs/REMOTE_Probe_Body.prefab");
|
||||
ShaderReplacer.ReplaceShaders(_prefab);
|
||||
return _prefab;
|
||||
}
|
||||
|
||||
public static Transform CreateProbe(PlayerInfo player)
|
||||
{
|
||||
var REMOTE_Probe_Body = Object.Instantiate(QSBCore.NetworkAssetBundle.LoadAsset<GameObject>("Assets/Prefabs/REMOTE_Probe_Body.prefab")).transform;
|
||||
var REMOTE_Probe_Body = Object.Instantiate(GetPrefab());
|
||||
|
||||
var qsbProbe = REMOTE_Probe_Body.gameObject.GetComponent<QSBProbe>();
|
||||
var qsbProbe = REMOTE_Probe_Body.GetComponent<QSBProbe>();
|
||||
player.Probe = qsbProbe;
|
||||
qsbProbe.SetOwner(player);
|
||||
|
||||
FixMaterialsInAllChildren.ReplaceMaterials(REMOTE_Probe_Body);
|
||||
player.ProbeBody = REMOTE_Probe_Body;
|
||||
|
||||
player.ProbeBody = REMOTE_Probe_Body.gameObject;
|
||||
|
||||
return REMOTE_Probe_Body;
|
||||
return REMOTE_Probe_Body.transform;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user