public void SavePlayerStatesData(BattlePlayer player)
    {
        PlayerStatesData data = new PlayerStatesData
        {
            LV  = player.STATES.LV,
            HP  = player.STATES.HP,
            MP  = player.STATES.MP,
            EXP = player.STATES.EXP,
        };

        playerStatesData = data;
    }
Beispiel #2
0
    /*
     * 初期化
     * プレイヤーと敵を生成
     * カメラの設定
     * 後々テーブルで敵の数などを決めれるようにする
     */
    void Start()
    {
        // プレイヤーの生成
        player = Instantiate(playerPrefab, new Vector3(PLAYER_POSITION, 0.0f, 0.0f), Quaternion.Euler(0, 90, 0)) as BattlePlayer;
        PlayerStatesData stateData = GlobalDataManager.GetGlobalData().LoadPlayerStatesData();

        if (stateData == null)
        {
            player.STATES = GlobalDataManager.GetGlobalData().GetDataBase().GetPlayerStates(1);
            player.HP     = player.STATES.HP;
        }
        else
        {
            player.STATES     = GlobalDataManager.GetGlobalData().GetDataBase().GetPlayerStates(stateData.LV);
            player.STATES.HP  = stateData.HP;
            player.HP         = stateData.HP;
            player.STATES.MP  = stateData.MP;
            player.STATES.EXP = stateData.EXP;
        }
        canvasManager.CreateStatesUI(player, true);

        // エネミーの生成
        EnemyTable table     = GlobalDataManager.GetGlobalData().GetEnemyTable().GetEnemyTable((int)Table.LEVEL.EASY);
        int        enemy_num = table.NUM;

        for (int i = 0; i < enemy_num; i++)
        {
            BattleEnemy enemy = Instantiate(enemyPrefab, new Vector3((i * 0.3f) + 0.3f, 0.0f, 0.0f), Quaternion.Euler(0, 270, 0)) as BattleEnemy;
            enemy.STATES  = GlobalDataManager.GetGlobalData().GetDataBase().GetSkeletonStates(table.LEVEL);
            enemy.HP      = enemy.STATES.HP;
            enemy.Manager = this;
            enemy.Player  = player;
            enemy.ID      = i;
            enemyList.Add(enemy);
            //canvasManager.CreateStatesUI(enemy);
            targetList.Add(i);
        }

        player.Manager = this;
        player.Enemy   = enemyList[player.TargetID];

        // カメラ位置の設定
        centerPoint.Player      = player.transform;
        centerPoint.TargetEnemy = enemyList[player.TargetID].transform;

        // ターゲットポインター
        targetPointer        = Instantiate(targetPointerPrefab);
        targetPointer.Target = player.Enemy;

        StartCoroutine(GameStart());
    }