forked from cgvr/DeltaVR
archery range npc voicelines for completing round and submitting name
This commit is contained in:
@@ -85,7 +85,6 @@ public class ArcheryRange : NetworkBehaviour
|
||||
_presentPlayers.Remove(exitedPlayer); // Shifts others left automatically
|
||||
|
||||
if (exitedPlayer == _scoredPlayer) keyboardManager.DeActivate(); // If the player <20>refuses to enter their name.
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,11 @@ public class KeyboardManager : NetworkBehaviour
|
||||
{
|
||||
public enum ShiftMode { Lowercase, NextUppercase, Uppercase }
|
||||
|
||||
public delegate void OnActivateDelegate();
|
||||
public event OnActivateDelegate OnActivate;
|
||||
public delegate void OnSubmitDelegate();
|
||||
public event OnSubmitDelegate OnSubmit;
|
||||
|
||||
[Header("UI References")]
|
||||
public TMP_Text nameTextField;
|
||||
public TMP_Text scoreTextField;
|
||||
@@ -57,6 +62,7 @@ public class KeyboardManager : NetworkBehaviour
|
||||
gameObject.transform.position = assignedTransform.position;
|
||||
gameObject.transform.rotation = assignedTransform.rotation;
|
||||
|
||||
OnActivate?.Invoke();
|
||||
}
|
||||
|
||||
public void DeActivate()
|
||||
@@ -64,7 +70,7 @@ public class KeyboardManager : NetworkBehaviour
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
private void addToInput(string newInput)
|
||||
private void AddToInput(string newInput)
|
||||
{
|
||||
|
||||
if (_input.Length < inputTextLimit)
|
||||
@@ -82,13 +88,13 @@ public class KeyboardManager : NetworkBehaviour
|
||||
switch (_shiftMode)
|
||||
{
|
||||
case ShiftMode.Lowercase:
|
||||
addToInput(letter.ToLower());
|
||||
AddToInput(letter.ToLower());
|
||||
break;
|
||||
case ShiftMode.Uppercase:
|
||||
addToInput(letter.ToUpper());
|
||||
AddToInput(letter.ToUpper());
|
||||
break;
|
||||
case ShiftMode.NextUppercase:
|
||||
addToInput(letter.ToUpper());
|
||||
AddToInput(letter.ToUpper());
|
||||
_shiftMode = ShiftMode.Lowercase;
|
||||
UpdateKeyLabels();
|
||||
break;
|
||||
@@ -124,6 +130,7 @@ public class KeyboardManager : NetworkBehaviour
|
||||
void OnEnterPressed()
|
||||
{
|
||||
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.LetterEnter, enterButton.gameObject);
|
||||
OnSubmit?.Invoke();
|
||||
|
||||
if (_input.Length > 0)
|
||||
{
|
||||
@@ -136,7 +143,7 @@ public class KeyboardManager : NetworkBehaviour
|
||||
{
|
||||
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.LetterEnter, spaceButton.gameObject);
|
||||
|
||||
addToInput(" ");
|
||||
AddToInput(" ");
|
||||
UpdateOutput();
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
@@ -15,6 +15,7 @@ public class ArcheryRangeNPC : NPCController
|
||||
public ModelDisplay modelDisplay;
|
||||
public float modelDisplaySize = 0.75f;
|
||||
public Transform startTargetQuestMarkerPoint;
|
||||
public KeyboardManager keyboardManager;
|
||||
|
||||
private Texture2D GeneratedTexture;
|
||||
|
||||
@@ -25,6 +26,8 @@ public class ArcheryRangeNPC : NPCController
|
||||
// 3 - player pressed the image generation button
|
||||
// 4 - player pressed the model generation button
|
||||
// 5 - model spawned into the game
|
||||
// 6 - round completed
|
||||
// 7 - name submitted
|
||||
private int state;
|
||||
|
||||
private void Awake()
|
||||
@@ -37,6 +40,8 @@ public class ArcheryRangeNPC : NPCController
|
||||
microphoneStand.OnPlayerUsedMicrophone += OnPlayerUsedMicrophone;
|
||||
imageGenerationButton.OnButtonPressed += OnImageGenerationButtonPressed;
|
||||
modelGenerationButton.OnButtonPressed += OnModelGenerationButtonPressed;
|
||||
keyboardManager.OnActivate += OnRoundComplete;
|
||||
keyboardManager.OnSubmit += OnNameSubmitted;
|
||||
}
|
||||
|
||||
protected async override void OnPlayerApproach()
|
||||
@@ -119,4 +124,23 @@ public class ArcheryRangeNPC : NPCController
|
||||
|
||||
modelGenerationButton.Deactivate();
|
||||
}
|
||||
|
||||
private void OnRoundComplete()
|
||||
{
|
||||
if (state == 5)
|
||||
{
|
||||
state = 6;
|
||||
SpeakVoiceLine(6);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void OnNameSubmitted()
|
||||
{
|
||||
if (state == 6)
|
||||
{
|
||||
state = 7;
|
||||
}
|
||||
SpeakVoiceLine(7);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user