@Override public void enter(PlayerInterface player) { // let the team know this player is controlling player.Team().setControllingPlayer(player); // the player can only make so many kick attempts per second. if (!player.isReadyForNextKick()) { player.GetFSM().changeState(ChaseBall.Instance()); if (debugThis) { System.out.println( "Player: " + player.ID() + " set to " + player.GetFSM().getCurrentState().getClass()); } } else { KeepAwayGlueSupport.getInstance().setPlayerToAct(player); } }
// @Override public void execute(PlayerInterface player) { // Get the action Action theAction = KeepAwayGlueSupport.getInstance().popAction(); if (theAction == null) { throw new IllegalStateException( "Execute was called on WaitForAgentChoice but there is no action in the hopper!"); } int primitiveAction = theAction.intArray[0]; if (primitiveAction == 0) stopBall(player); if (primitiveAction == 1) dribbleBall(player); if (primitiveAction == 2) kickBall(player); if (debugThis) { System.out.println( "Player: " + player.ID() + " set to " + player.GetFSM().getCurrentState().getClass()); } }