mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-26 09:35:26 +00:00
split methods
This commit is contained in:
parent
983832193d
commit
1d2e586d66
@ -42,35 +42,50 @@ namespace QSB.ConversationSync.Events
|
|||||||
var dialogueTree = QSBWorldSync.OldDialogueTrees[message.CharacterId];
|
var dialogueTree = QSBWorldSync.OldDialogueTrees[message.CharacterId];
|
||||||
var animController = Resources.FindObjectsOfTypeAll<CharacterAnimController>().FirstOrDefault(x => x.GetValue<CharacterDialogueTree>("_dialogueTree") == dialogueTree);
|
var animController = Resources.FindObjectsOfTypeAll<CharacterAnimController>().FirstOrDefault(x => x.GetValue<CharacterDialogueTree>("_dialogueTree") == dialogueTree);
|
||||||
|
|
||||||
// Make character face player and talk
|
|
||||||
if (animController == default(CharacterAnimController))
|
if (animController == default(CharacterAnimController))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.State)
|
if (message.State)
|
||||||
{
|
{
|
||||||
// Start talking
|
StartConversation(message.PlayerId, message.CharacterId, animController, dialogueTree);
|
||||||
QSBPlayerManager.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");
|
|
||||||
}
|
|
||||||
dialogueTree.GetComponent<InteractVolume>().DisableInteraction();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Stop talking
|
EndConversation(message.PlayerId, animController, dialogueTree);
|
||||||
QSBPlayerManager.GetPlayer(message.PlayerId).CurrentDialogueID = -1;
|
|
||||||
animController.SetValue("_inConversation", false);
|
|
||||||
animController.SetValue("_playerInHeadZone", false);
|
|
||||||
if (animController.GetValue<bool>("_hasTalkAnimation"))
|
|
||||||
{
|
|
||||||
animController.GetValue<Animator>("_animator").SetTrigger("Idle");
|
|
||||||
}
|
|
||||||
dialogueTree.GetComponent<InteractVolume>().EnableInteraction();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void StartConversation(
|
||||||
|
uint playerId,
|
||||||
|
int characterId,
|
||||||
|
CharacterAnimController controller,
|
||||||
|
CharacterDialogueTree tree)
|
||||||
|
{
|
||||||
|
QSBPlayerManager.GetPlayer(playerId).CurrentDialogueID = characterId;
|
||||||
|
controller.SetValue("_inConversation", true);
|
||||||
|
controller.SetValue("_playerInHeadZone", true);
|
||||||
|
if (controller.GetValue<bool>("_hasTalkAnimation"))
|
||||||
|
{
|
||||||
|
controller.GetValue<Animator>("_animator").SetTrigger("Talking");
|
||||||
|
}
|
||||||
|
tree.GetComponent<InteractVolume>().DisableInteraction();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void EndConversation(
|
||||||
|
uint playerId,
|
||||||
|
CharacterAnimController controller,
|
||||||
|
CharacterDialogueTree tree)
|
||||||
|
{
|
||||||
|
QSBPlayerManager.GetPlayer(playerId).CurrentDialogueID = -1;
|
||||||
|
controller.SetValue("_inConversation", false);
|
||||||
|
controller.SetValue("_playerInHeadZone", false);
|
||||||
|
if (controller.GetValue<bool>("_hasTalkAnimation"))
|
||||||
|
{
|
||||||
|
controller.GetValue<Animator>("_animator").SetTrigger("Idle");
|
||||||
|
}
|
||||||
|
tree.GetComponent<InteractVolume>().EnableInteraction();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user