Пример #1
0
    private void initEnemy(int enemy_id)
    {
        if (m_BattleDispEnemy != null && m_MasterDataParamEnemys != null)
        {
            //MasterDataParamEnemy enemy_master = searchEnemy(enemy_id);
            int index = searchEnemyIndex(enemy_id);
            MasterDataParamEnemy enemy_master = m_MasterDataParamEnemys[index];

            if (enemy_master != null)
            {
                MasterDataParamChara chara_master = MasterFinder <MasterDataParamChara> .Instance.Find((int)enemy_master.chara_id);

                if (chara_master != null)
                {
                    MasterDataParamEnemy wrk_enemy_master = new MasterDataParamEnemy();
                    wrk_enemy_master.Copy(enemy_master); //元のマスターデータに影響が出ないようにコピーを作成
                    BattleEnemy battle_enemy = null;
                    {
                        battle_enemy = new BattleEnemy();
                        battle_enemy.setMasterData(wrk_enemy_master, chara_master);
                        battle_enemy.m_EnemyAttack        = enemy_master.status_pow;
                        battle_enemy.m_EnemyDefense       = enemy_master.status_def;
                        battle_enemy.m_EnemyHP            = enemy_master.status_hp;
                        battle_enemy.m_EnemyHPMax         = enemy_master.status_hp;
                        battle_enemy.m_EnemyDrop          = 0;
                        battle_enemy.m_StatusAilmentChara = new StatusAilmentChara(StatusAilmentChara.OwnerType.ENEMY);
                        battle_enemy.setAcquireDropUnit(false);
                    }
                    m_CurrentBattleEnemy   = battle_enemy;
                    m_CurrentEnemyDispInfo = m_EnemyDispInfos[index];

                    setInfoToInteface();
                    setInfoToWorkMaster();

                    m_BattleEnemys    = new BattleEnemy[1];
                    m_BattleEnemys[0] = battle_enemy;

                    m_BattleDispEnemy.instanceObject(m_BattleEnemys);

                    m_BattleDispEnemy.gameObject.SetLayerRecursively(LayerMask.NameToLayer("BATTLE")); // レイヤーを設定し直し

                    m_BattleDispEnemy.showTargetCursor(0);                                             // ターゲットカーソルを表示
                }
            }
            else
            {
                m_BattleDispEnemy.instanceObject(null);
            }
        }
    }