Пример #1
0
    public void InitializeMonsterSpawnPoint(int stageIndex)
    {
        Stage stageData = dungeonLevelData.GetStage(stageIndex);

        monsterSpawnPoints = new GameObject[stageData.GetMonsterNum()];

        for (int i = 0; i < stageData.GetMonsterNum(); i++)
        {
            monsterSpawnPoints[i] = GameObject.Find("MonsterSpawnPoint" + (i + 1));
        }
    }
        public bool Deserialize(ref DungeonLevelData element)
        {
            if (GetDataSize() == 0)
            {
                // 데이터가 설정되지 않았다.
                return(false);
            }

            bool ret          = true;
            byte stageNum     = 0;
            byte waveCount    = 0;
            byte monsterKind  = 0;
            byte monsterId    = 0;
            byte monsterLevel = 0;
            byte monsterNum   = 0;

            ret &= Deserialize(ref stageNum);
            ret &= Deserialize(ref waveCount);

            element = new DungeonLevelData(stageNum, waveCount);

            for (int stageIndex = 0; stageIndex < stageNum; stageIndex++)
            {
                ret &= Deserialize(ref monsterKind);

                for (int monsterIndex = 0; monsterIndex < monsterKind; monsterIndex++)
                {
                    ret &= Deserialize(ref monsterId);
                    ret &= Deserialize(ref monsterLevel);
                    ret &= Deserialize(ref monsterNum);
                }

                element.AddStage(new Stage(stageIndex));
                element.GetStage(stageIndex).AddMonster(monsterId, monsterLevel, monsterNum);
            }

            return(ret);
        }