fixed bugs

This commit is contained in:
Mister_Nebula 2020-10-24 19:04:50 +01:00
parent 25e442ddba
commit 3b42096d8c
3 changed files with 30 additions and 16 deletions

View File

@ -31,6 +31,7 @@ namespace QSB.ConversationSync
DebugLog.ToConsole("Error - Font is null!", MessageType.Error);
}
BoxPrefab.GetComponent<Text>().font = font;
BoxPrefab.GetComponent<Text>().color = Color.white;
DebugLog.LogState("BoxPrefab", BoxPrefab);
}

View File

@ -63,13 +63,22 @@ namespace QSB.ConversationSync
{
position = PlayerRegistry.GetPlayer(playerId).Camera.transform.position;
}
float b = ___headTrackingWeight * (float)Mathf.Min(1, (!___lookOnlyWhenTalking) ? ((!____playerInHeadZone) ? 0 : 1) : ((!____inConversation || !____playerInHeadZone) ? 0 : 1));
float b = ___headTrackingWeight * Mathf.Min(1, (!___lookOnlyWhenTalking) ? ((!____playerInHeadZone) ? 0 : 1) : ((!____inConversation || !____playerInHeadZone) ? 0 : 1));
____currentLookWeight = Mathf.Lerp(____currentLookWeight, b, Time.deltaTime * 2f);
____currentLookTarget = ___lookSpring.Update(____currentLookTarget, position, Time.deltaTime);
____animator.SetLookAtPosition(____currentLookTarget);
____animator.SetLookAtWeight(____currentLookWeight);
return false;
}
public static bool OnZoneExit(CharacterDialogueTree ____dialogueTree)
{
var playerId = ConversationManager.Instance.GetPlayerTalkingToTree(____dialogueTree);
if (playerId == uint.MaxValue)
{
return true;
}
return false;
}
public static void AddPatches()
@ -79,6 +88,7 @@ namespace QSB.ConversationSync
QSB.Helper.HarmonyHelper.AddPostfix<CharacterDialogueTree>("StartConversation", typeof(ConversationPatches), nameof(StartConversation));
QSB.Helper.HarmonyHelper.AddPostfix<CharacterDialogueTree>("EndConversation", typeof(ConversationPatches), nameof(EndConversation));
QSB.Helper.HarmonyHelper.AddPrefix<CharacterAnimController>("OnAnimatorIK", typeof(ConversationPatches), nameof(OnAnimatorIK));
QSB.Helper.HarmonyHelper.AddPrefix<CharacterAnimController>("OnZoneExit", typeof(ConversationPatches), nameof(OnZoneExit));
}
}
}

View File

@ -34,25 +34,28 @@ namespace QSB.ConversationSync
return;
}
var dialogueTree = WorldRegistry.OldDialogueTrees[message.CharacterId];
var animController = Resources.FindObjectsOfTypeAll<CharacterAnimController>().First(x => x.GetValue<CharacterDialogueTree>("_dialogueTree") == dialogueTree);
if (message.State)
var animController = Resources.FindObjectsOfTypeAll<CharacterAnimController>().FirstOrDefault(x => x.GetValue<CharacterDialogueTree>("_dialogueTree") == dialogueTree);
if (animController != default(CharacterAnimController))
{
PlayerRegistry.GetPlayer(message.PlayerId).CurrentDialogueID = message.CharacterId;
animController.SetValue("_inConversation", true);
animController.SetValue("_playerInHeadZone", true);
if (animController.GetValue<bool>("_hasTalkAnimation"))
if (message.State)
{
animController.GetValue<Animator>("_animator").SetTrigger("Talking");
PlayerRegistry.GetPlayer(message.PlayerId).CurrentDialogueID = message.CharacterId;
animController.SetValue("_inConversation", true);
animController.SetValue("_playerInHeadZone", true);
if (animController.GetValue<bool>("_hasTalkAnimation"))
{
animController.GetValue<Animator>("_animator").SetTrigger("Talking");
}
}
}
else
{
PlayerRegistry.GetPlayer(message.PlayerId).CurrentDialogueID = -1;
animController.SetValue("_inConversation", false);
animController.SetValue("_playerInHeadZone", false);
if (animController.GetValue<bool>("_hasTalkAnimation"))
else
{
animController.GetValue<Animator>("_animator").SetTrigger("Idle");
PlayerRegistry.GetPlayer(message.PlayerId).CurrentDialogueID = -1;
animController.SetValue("_inConversation", false);
animController.SetValue("_playerInHeadZone", false);
if (animController.GetValue<bool>("_hasTalkAnimation"))
{
animController.GetValue<Animator>("_animator").SetTrigger("Idle");
}
}
}