// Start is called before the first frame update
    void Start()
    {
        ShowMessage("戦闘開始");
        // キャラクターインスタンスの親
        charactersParent = new GameObject("Characters").transform;
        // キャラクターを配置するTransform
        Transform characterTransform;
        // 同じ名前の敵がいた場合の処理に使うリスト
        List <string> enemyNameList = new List <string>();

        GameObject      ins;
        CharacterBattle characterBattleScript;
        string          characterName;

        // 味方パーティーのプレハブをインスタンス化
        for (int i = 0; i < battleData.GetAllyPartyStatus().GetAllyGameObject().Count; i++)
        {
            characterTransform = battleBasePosition.Find("AllyPos" + i).transform;
            ins = Instantiate <GameObject>(battleData.GetAllyPartyStatus().GetAllyGameObject()[i], characterTransform.position, characterTransform.rotation, charactersParent);
            characterBattleScript = ins.GetComponent <CharacterBattle>();
            ins.name = characterBattleScript.GetCharacterStatus().GetCharacterName();
            if (characterBattleScript.GetCharacterStatus().GetHp() > 0)
            {
                allyCharacterInBattleList.Add(ins);
                allCharacterList.Add(ins);
            }
        }

        // 敵パーティーのプレハブをインスタンス化
        for (int i = 0; i < battleData.GetEnemyPartyStatus().GetEnemyGameObjectList().Count; i++)
        {
            characterTransform = battleBasePosition.Find("EnemyPos" + i).transform;
            ins = Instantiate <GameObject>(battleData.GetEnemyPartyStatus().GetEnemyGameObjectList()[i], characterTransform.position, characterTransform.rotation, charactersParent);
            // 既に同じ敵が存在したら文字を付加する
            characterName = ins.GetComponent <CharacterBattle>().GetCharacterStatus().GetCharacterName();
            if (!enemyNameList.Contains(characterName))
            {
                ins.name = characterName + 'A';
            }
            else
            {
                ins.name = characterName + (char)('A' + enemyNameList.Count(enemyName => enemyName == characterName));
            }
            enemyNameList.Add(characterName);
            enemyCharacterInBattleList.Add(ins);
            allCharacterList.Add(ins);
            //EnemyStatusのSetEnemyNumberにアクセスしてる
            ((EnemyStatus)ins.GetComponent <CharacterBattle>().GetCharacterStatus()).SetEnemyName(ins.name);
        }
        // キャラクターリストをキャラクターの素早さの高い順に並べ替え
        allCharacterList = allCharacterList.OrderByDescending(character => character.GetComponent <CharacterBattle>().GetCharacterStatus().GetAgility()).ToList <GameObject>();
        // 現在の戦闘
        allCharacterInBattleList = allCharacterList.ToList <GameObject>();
        // 確認の為並べ替えたリストを表示

        /*foreach (var character in allCharacterInBattleList)
         * {
         *  Debug.Log(character.GetComponent<CharacterBattle>().GetCharacterStatus().GetCharacterName() + " : " + character.GetComponent<CharacterBattle>().GetCharacterStatus().GetAgility());
         * }*/
        // 戦闘前の待ち時間を設定
        waitTime = firstWaitingTime;
        // ランダム値のシードの設定
        Random.InitState((int)Time.time);

        yusyaObjct = GameObject.Find("ゆうしゃ");
    }