Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.01 KB | None | 0 0
  1. using UnityEngine;
  2. using AC;
  3. using UnityEngine.EventSystems;
  4.  
  5. namespace Scuac.Components
  6. {
  7.     public class SkipSpeechButton : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
  8.     {
  9.         bool isPressed;
  10.         bool isSpeechPlaying;
  11.  
  12.         public void OnPointerDown(PointerEventData eventData)
  13.         {
  14.             isSpeechPlaying = KickStarter.dialog.IsAnySpeechPlaying();
  15.             isPressed = true;
  16.         }
  17.  
  18.         public void OnPointerUp(PointerEventData eventData)
  19.         {
  20.             isPressed = false;
  21.         }
  22.  
  23.         void Update()
  24.         {
  25.             if (!isPressed)
  26.                 return;
  27.  
  28.             if (isSpeechPlaying)
  29.             {
  30.                 // These doesn't work here
  31.                 KickStarter.playerInput.ResetClick();
  32.                 KickStarter.playerInput.ResetMouseClick();
  33.  
  34.                 // This works but cuts off the speech too late
  35.                 KickStarter.playerInput.SimulateInputButton("SkipSpeech");
  36.             }
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement