Exemplo n.º 1
0
    public void OnLBumper(CallbackContext context) //this is coded a bit shit; currently it is forced for Drop Ball and Gather Ball to be mapped to the same button, potentially move sorting logic into Mover class or another class
    {
        pressLBCounter++;

        //Debug.Log("LB presses: " + pressCounterLB.ToString());
        if (mover != null)
        {
            if (pressLBCounter == 1) //onEntered: when button is first pressed
            {
                //do nothing?
            }
            if (pressLBCounter == 2)       //onPressed: when button is first pressed but after onEntered; if you hold down button it wont do anything further until released
            {
                if (mover.hasBall == true) //if they DO have the ball then release it
                {
                    mover.DropBall();
                }
                else //if they DONT have the ball then set isGathering to true; the gatherCollider will then automatically pick it up
                {
                    mover.SetIsGathering(context.ReadValue <float>());
                }
            }
            if (pressLBCounter == 3) //onRelease: when button is released
            {
                //if they DONT have the ball then set isGathering to false
                mover.SetIsGathering(context.ReadValue <float>());
                pressLBCounter = 0; //on release prep it so the next press takes them to onEntered again
            }
        }
    }