public void AddSetPiece(Side side, RestartActionType type)
 {
     if (type == RestartActionType.CORNER && side == Side.ENEMY)
     {
         enemyTeamCorners++;
     }
     else if (type == RestartActionType.FREEKICK && side == Side.ENEMY)
     {
         enemyTeamFreeKicks++;
     }
     else if (type == RestartActionType.OUT && side == Side.ENEMY)
     {
         enemyTeamThrowIns++;
     }
     else if (type == RestartActionType.CORNER && side == Side.PLAYER)
     {
         playerTeamCorners++;
     }
     else if (type == RestartActionType.FREEKICK && side == Side.PLAYER)
     {
         playerTeamFreeKicks++;
     }
     else if (type == RestartActionType.OUT && side == Side.PLAYER)
     {
         playerTeamThrowIns++;
     }
 }
 public RestartAction(RestartActionType type, Side performingSide, bool isPlayerPerforming, Vector2 source)
 {
     this.type               = type;
     this.performingSide     = performingSide;
     this.isPlayerPerforming = isPlayerPerforming;
     this.source             = source;
 }
示例#3
0
    public void FreeKickAction()
    {
        GameManager.instance.stats.AddSetPiece(GameManager.instance.possession, RestartActionType.FREEKICK);
        GameManager.instance.logs.FlushTheBuffer();
        RestartActionType moveType = RestartActionType.FREEKICK;
        string            move     = "Freekick";

        if (CalculationsManager.IsBallOnPenaltyArea() && CalculationsManager.GetResultByPercent(0.5f))
        {
            moveType = RestartActionType.PENALTY;
            move     = "Penalty";
        }
        if (CalculationsManager.IsPlayerStandingOnBall() && GameManager.instance.player.contusion == null && !GameManager.instance.player.IsEnergyDepleted())
        {
            GameManager.instance.nextAction = new RestartAction(moveType, Side.PLAYER, true, GameManager.instance.ballPosition);
        }
        else
        {
            GameManager.instance.nextAction = new RestartAction(moveType, CalculationsManager.OtherSide(GameManager.instance.possession), false, GameManager.instance.ballPosition);
        }
        GameManager.instance.SetSelectedMove(move);
        GameManager.instance.PrepareForRestartMove();
    }