Commit d91546c4 authored by radow's avatar radow
Browse files

postcard voice overlap fix

parent 55c3a36a
......@@ -32,7 +32,7 @@ public class Postcard : MonoBehaviour, IInteractable
interactedwith = true;
floaty.enabled = false;
curvePath.SetActive(true);
voice.PlayClip();
voice.TryPlayClip() ; // what do we do when another clip is playing?
}
public bool MayInteract()
......
......@@ -32,6 +32,15 @@ public class VoicelineTrigger : MonoBehaviour
}
int i;
public void TryPlayClip()
{
if (!blocked &&!finished && (Time.time - lasttimeplayed > perroomCooldown || (lastTrigger != this && Time.time - lasttimeplayed > globalcooldown)))
{
PlayClip();
}
}
public void PlayClip()
{
if(i>= clips.Count)
......@@ -50,9 +59,7 @@ public class VoicelineTrigger : MonoBehaviour
{
if (other.GetComponentInParent<PlayerController>() && !blocked && InputMode.mode == InputMode.Mode.PLAYMODE)
{
if (!finished && (Time.time - lasttimeplayed > perroomCooldown || (lastTrigger!= this && Time.time - lasttimeplayed > globalcooldown))){
PlayClip();
}
TryPlayClip();
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment