- Home /
 
               Question by 
               DDDimanN79 · Oct 26, 2015 at 12:32 PM · 
                axisjoystickverticalhorizontaldouble-click  
              
 
              How to detect Double Clicking Horizontal/Vertical Axis on joystick
Hello everybody! I'm trying to write a control character for the fighting game and I need to detect double click on the joystick Axis. I have a script for detecting the arrow buttons but I do not understand how to adapt it for the joystick. Anybody knows how to do this?
public class InputCore : MonoBehaviour {
 public static InputCore Global;
 public float MaxDoubleClickTime = 0.3f;
 float TimerA;
 float TimerD;
 
 public bool DoubleClickA;
 public bool DoubleClickD;
 void Awake () {
     Global = this;
 }
 
 void Update () {
     DoubleClickA = false;
     DoubleClickD = false;
     
     TimerA += Time.deltaTime;
     TimerD += Time.deltaTime;
     
     //A -----------------------------------------------
     
     if (Input.GetKeyDown (KeyCode.A))
     {
             if (TimerA <= MaxDoubleClickTime)
         {
             DoubleClickA = true;
         }
         
         TimerA = 0;
     }
     //D -----------------------------------------------
     
     if (Input.GetKeyDown (KeyCode.D))
     {
         
         if (TimerD <= MaxDoubleClickTime)
         {
             DoubleClickD = true;
         }
         
         TimerD = 0;
     }
 }
}
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                