public void UpdatePlayerTurnAvailability(string playerName, TurnAvailabilityEnum turnAvailabilityEnum)
 {
     if (!this.PlayerTurnAvailability.ContainsKey(playerName))
     {
         this.PlayerTurnAvailability.Add(playerName, turnAvailabilityEnum);
     }
     else
     {
         this.PlayerTurnAvailability[playerName] = turnAvailabilityEnum;
     }
 }
    public void CalculateRunnerColliderInterraction(BaseEnum baseReached, bool isNextRunnerTurnPossible = false)
    {
        Debug.Log(this.name + " interracted with " + baseReached.ToString());
        this.CurrentBase = baseReached;

        PlayerStatus playerStatusScript = PlayerUtils.FetchPlayerStatusScript(this.gameObject);

        this.EnableMovement = false;

        PlayersTurnManager   playersTurnManager   = GameUtils.FetchPlayersTurnManager();
        TurnAvailabilityEnum turnAvailabilityEnum = TurnAvailabilityEnum.READY;

        switch (baseReached)
        {
        case BaseEnum.HOME_BASE:

            if (baseReached == BaseEnum.HOME_BASE && !this.HasPassedThroughThreeFirstBases())
            {
                Debug.Log("Get on HOME BASE FIRST TIME !!");
                this.NextBase = BaseEnum.FIRST_BASE;
                playersTurnManager.TurnState = TurnStateEnum.STANDBY;
                playersTurnManager.UpdatePlayerTurnAvailability(this.gameObject.name, turnAvailabilityEnum);
            }
            else
            {
                Debug.Log("Get on HOME BASE to mark a point");
                Debug.Log("WIN ONE POINT !!!");
                this.Target   = null;
                this.NextBase = this.CurrentBase;
                playerStatusScript.IsAllowedToMove = false;
                this.HasReachedHomeBase            = true;

                PlayerEnum        playerEnum = playerStatusScript.PlayerOwner;
                TeamsScoreManager teamsScoreManagerScript = GameUtils.FetchTeamsScoreManager();
                teamsScoreManagerScript.IncrementTeamScore(GameData.teamIdEnumMap[playerEnum]);
                this.IsStaying = true;
                IsoRenderer.ReinitializeAnimator();
                GameManager gameManager = GameUtils.FetchGameManager();

                this.gameObject.SetActive(false);
                gameManager.AttackTeamRunnerList.Remove(this.gameObject);
                playersTurnManager.UpdatePlayerTurnQueue(this.gameObject);
                gameManager.AttackTeamRunnerHomeList.Add(this.gameObject);

                int batterCount = gameManager.AttackTeamBatterListClone.Count;
                if (this.EquipedBat != null && batterCount > 0)
                {
                    GameObject      newBatter = gameManager.AttackTeamBatterListClone.First();
                    BatterBehaviour newbatterBehaviourScript = PlayerUtils.FetchBatterBehaviourScript(newBatter);
                    newbatterBehaviourScript.EquipedBat = this.EquipedBat;
                    this.EquipedBat = null;
                    gameManager.EquipBatToPlayer(newBatter);
                }

                int runnersCount = gameManager.AttackTeamRunnerList.Count;

                bool isRunnersAllSafeAndStaying = gameManager.AttackTeamRunnerList.TrueForAll(runner => {
                    RunnerBehaviour runnerBehaviour = PlayerUtils.FetchRunnerBehaviourScript(runner);
                    return(runnerBehaviour.IsSafe && runnerBehaviour.IsStaying);
                });

                if (runnersCount == 0 && batterCount == 0 || batterCount == 0 && runnersCount > 0 && isRunnersAllSafeAndStaying)
                {
                    gameManager.IsStateCheckAllowed = false;
                    gameManager.ProcessNextInningHalf();
                }
                else
                {
                    gameManager.IsStateCheckAllowed = true;
                }
            }

            break;

        case BaseEnum.FIRST_BASE:
            Debug.Log("Get on FIRST BASE");

            this.NextBase            = BaseEnum.SECOND_BASE;
            this.HasReachedFirstBase = true;
            if (this.IsInWalkState)
            {
                this.IsInWalkState   = false;
                turnAvailabilityEnum = TurnAvailabilityEnum.WAITING;
                IsoRenderer.ReinitializeAnimator();
            }

            playersTurnManager.UpdatePlayerTurnAvailability(this.gameObject.name, turnAvailabilityEnum);
            break;

        case BaseEnum.SECOND_BASE:
            Debug.Log("Get on SECOND BASE");
            this.NextBase             = BaseEnum.THIRD_BASE;
            this.HasReachedSecondBase = true;
            playersTurnManager.UpdatePlayerTurnAvailability(this.gameObject.name, turnAvailabilityEnum);
            break;

        case BaseEnum.THIRD_BASE:
            Debug.Log("Get on THIRD BASE");
            this.NextBase            = BaseEnum.HOME_BASE;
            this.HasReachedThirdBase = true;
            playersTurnManager.UpdatePlayerTurnAvailability(this.gameObject.name, turnAvailabilityEnum);
            break;

        default:
            Debug.Log("DO NOT KNOW WHAT HAPPEN");
            break;
        }

        if (isNextRunnerTurnPossible)
        {
            playersTurnManager.TurnState      = TurnStateEnum.RUNNER_TURN;
            PlayersTurnManager.IsCommandPhase = true;
        }
    }