How to reseting int ??
hy,, i have question : how to resetting int, i make combo button, but when i press button again and again, it can't to attack anymore until i stop press button and always wait for int time. so i need to make when i press button again and again, the int can resetting to 0 automaticly and faster. this my script :
         int noOfClicks = 3; //i mean this int
     float lastClickedTime = 0.25f;
     float maxComboDelay = 0.5f;
 
         void Update()
     {
         if (Time.time - lastClickedTime > maxComboDelay) 
         {
             noOfClicks = 0;
         }
          }
 
 public void OnClick()
     {
         lastClickedTime = Time.time;
         noOfClicks++;
 
         if (noOfClicks == 1) 
         {
             animatio.SetBool("Atk4", true);
         }
 
         if (noOfClicks >= 2) 
         {
             animatio.SetBool("Atk4", true);
         }
 
         if (noOfClicks >= 3) 
         {
             animatio.SetBool("Atk4", true);
         }
 
         if (noOfClicks >= 4) 
         {
             animatio.SetBool("Atk4", true);
         }
 
         noOfClicks = Mathf.Clamp (noOfClicks, 0, 4);
     }
 //So how i can to stop int automaticly when i press fourtime, i need int back to 0 automaticly, more fater and ready when i press button again.
 
U just have to put your maxComboDelay down, otherwice you have to wait to long but the rest is correct i think. If the player press the button and than dont press for maxComboDelay time the int is resettet and the player can start a new combo.
Answer by BackslashOllie · May 27, 2016 at 10:32 AM
Is this what you mean?
          if (noOfClicks >= 4) 
          {
              animatio.SetBool("Atk4", true);
              noOfClicks = 0; //Add this
          }
Your answer
 
 
             Follow this Question
Related Questions
Simple Button Pressed Question? 1 Answer
How to call an int value from another void 1 Answer
how to subtract from int once c# 0 Answers
Can't disable TMPro Buttons 1 Answer
Toggle a bool on only one object at a time by tapping an object. 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                