Exemplo n.º 1
0
 public void OnRTrigger(CallbackContext context)
 {
     if (mover != null)
     {
         if (context.ReadValue <float>() > 0f)           //onPressed (this could run an unknown amount of times)
         {
             if (rightTriggerAlreadySuppressed == false) //used to make sure the action only runs once until this trigger is released
             {
                 if (mover.hasBall == true)              //if they DO have the ball then start charging
                 {
                     mover.ChargeThrow();                //start charging
                 }
                 else //if they DONT have the ball then do nothing? (potentially make this shield)
                 {
                 }
             }
             rightTriggerAlreadySuppressed = true;
         }
         else if (context.ReadValue <float>() == 0f)                     //onRelease
         {
             if (mover.hasBall == true && mover.hasChargedThrow == true) //if they DO have the ball AND have already started charging a throw then release the throw
             {
                 mover.ThrowBall();
             }
             else //if they DONT have the ball then do nothing? need to factor in the possibility that the ball has been stolen since they started charging
             {
             }
             rightTriggerAlreadySuppressed = false;
         }
     }
 }