Fixes for possessable avatars

This commit is contained in:
Pascal Serrarens 2022-02-18 17:42:44 +01:00
parent d5de37a168
commit 45cd4a16ef
4 changed files with 23 additions and 64 deletions

View File

@ -1498,7 +1498,10 @@ namespace Passer.Humanoid {
if (msg.possessionLocation != null) { if (msg.possessionLocation != null) {
Debug.Log("Need to download avatar possession from " + msg.possessionLocation); Debug.Log("Need to download avatar possession from " + msg.possessionLocation);
VisitorPossessions.RetrievePossessableAsync(msg.possessionLocation, msg.avatarPrefabName, retrievedAvatar => ProcessRetrievedAvatar(networking, remoteHumanoid, retrievedAvatar)); HumanoidPlayer.instance.StartCoroutine(
VisitorPossessions.RetrievePossessableAsync(msg.possessionLocation, msg.avatarPrefabName,
retrievedAvatar => ProcessRetrievedAvatar(networking, remoteHumanoid, retrievedAvatar))
);
return; return;
} }

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;
@ -125,6 +126,8 @@ namespace Passer.Humanoid {
public List<HumanoidControl> humanoids { get; set; } public List<HumanoidControl> humanoids { get; set; }
protected virtual void Awake() { protected virtual void Awake() {
mInstance = this;
GameObject.DontDestroyOnLoad(this.gameObject); GameObject.DontDestroyOnLoad(this.gameObject);
humanoids = HumanoidNetworking.FindLocalHumanoids(); humanoids = HumanoidNetworking.FindLocalHumanoids();
@ -139,6 +142,20 @@ namespace Passer.Humanoid {
} }
} }
static HumanoidPlayer mInstance;
public static HumanoidPlayer instance {
get {
if (mInstance == null) {
Debug.LogWarning("No HumanoidPlayer instance found, instantiating a new instance...");
GameObject go = new GameObject();
mInstance = go.AddComponent<HumanoidPlayer>();
}
return mInstance;
}
}
//public static void StartStaticCoroutine(IEnumerator coroutineMethod) {
// StartCoroutine(coroutineMethod);
//}
#endif #endif
[SerializeField] [SerializeField]

View File

@ -279,6 +279,7 @@ namespace Passer {
GameObject prefab; GameObject prefab;
if (possessableLocation == "") { if (possessableLocation == "") {
Debug.Log("Cannot retrieve Possessable: location is not set");
yield return null; yield return null;
} }
else { else {

View File

@ -2345,7 +2345,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
loadSiteAtStart: 0 loadSiteAtStart: 0
startSite: passervr.com/sites/avatarshop startSite: passervr.com/sites/start
startScene: startScene:
--- !u!114 &406190707 --- !u!114 &406190707
MonoBehaviour: MonoBehaviour:
@ -10131,68 +10131,6 @@ LineRenderer:
generateLightingData: 0 generateLightingData: 0
m_UseWorldSpace: 0 m_UseWorldSpace: 0
m_Loop: 0 m_Loop: 0
--- !u!1001 &1716426162
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1810220956971058, guid: def06cb2d19a8f74b8f61ea42324f172, type: 3}
propertyPath: m_Name
value: HumanoidPlayer
objectReference: {fileID: 0}
- target: {fileID: 4191195719973714, guid: def06cb2d19a8f74b8f61ea42324f172, type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 4191195719973714, guid: def06cb2d19a8f74b8f61ea42324f172, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4191195719973714, guid: def06cb2d19a8f74b8f61ea42324f172, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4191195719973714, guid: def06cb2d19a8f74b8f61ea42324f172, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4191195719973714, guid: def06cb2d19a8f74b8f61ea42324f172, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4191195719973714, guid: def06cb2d19a8f74b8f61ea42324f172, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4191195719973714, guid: def06cb2d19a8f74b8f61ea42324f172, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4191195719973714, guid: def06cb2d19a8f74b8f61ea42324f172, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4191195719973714, guid: def06cb2d19a8f74b8f61ea42324f172, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4191195719973714, guid: def06cb2d19a8f74b8f61ea42324f172, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4191195719973714, guid: def06cb2d19a8f74b8f61ea42324f172, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 114636771493283014, guid: def06cb2d19a8f74b8f61ea42324f172,
type: 3}
propertyPath: _debug
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: def06cb2d19a8f74b8f61ea42324f172, type: 3}
--- !u!1 &1721872685 --- !u!1 &1721872685
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0