예제 #1
0
    public void PrepareEnterDungeons()
    {
        if (GameSettings.Singleton.m_isSingle)
        {
            //test
            //Debug.Log("begin random map");
            RandomMapGenerator rmg = new RandomMapGenerator();
            rmg.setup(1, 1, 4f, 9f, 8f, 5f, 5);
            //FileStream aFiler = File.OpenRead("testData.txt");

            //StreamReader sr = new StreamReader("E:\\testData.txt", Encoding.Default);
            string result = "";
            //                String line;
            //while ((line = sr.ReadLine()) != null)
            //{
            //   result += line;
            //}
            Debug.Log("finish random map");
            result = rmg.generate();
            Debug.Log(result);
            SM.RandomRoomLevel.Singleton.ParseDataBuildTree(result);
            SM.RandomRoomLevel.Singleton.NotifyChanged((int)SM.RandomRoomLevel.ENPropertyChanged.enEnterDungeon, null);
        }
        else
        {
            // 进入LOADING
            Loading.Singleton.SetLoadingTips((int)LOADINGTIPSENUM.enEnterCopy);


            // 发送当前选择的 战友
            int msgID = MiniServer.Singleton.SendSelectBattleHelper(StageMenu.Singleton.m_curHelperGuid);

            UIStageMenu.GetInstance().RegisterRespondFuncByMessageID(msgID, OnSelectHelperCallback);
        }
    }
예제 #2
0
    // Use this for initialization
    void Start()
    {
        _rmg = GetComponent <RandomMapGenerator>();

        Activate();

        //// 最初のマスを強制アクティブ化
        _rmg._maps[0, 0].gameObject.SetActive(true);
        _rmg._maps[0, 0].UpdateActived(true);
    }
예제 #3
0
    // Use this for initialization
    void Start()
    {
        //マップ情報取得
        _mapGen = GetComponent <RandomMapGenerator> ();

        //プレイヤーの座標を設定
        SetPlayerPosition();

        //全てのオブジェクトの生成
        CreateAllObject();
    }
예제 #4
0
    // Start is called before the first frame update
    void Start()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
    }
예제 #5
0
        void Awake()
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            var time1 = stopwatch.ElapsedMilliseconds;

            print("time1 " + time1);

            var chunksCountX = (int)Mathf.Ceil((float)xResolution / MaxResolutionOfSingleChunk);
            int chunkSizeX   = xResolution / chunksCountX;

            var chunksCountZ = (int)Mathf.Ceil((float)zResolution / MaxResolutionOfSingleChunk);
            int chunkSizeZ   = zResolution / chunksCountZ;

            var chunks = new MapChunk[chunksCountX, chunksCountZ];

            var MapChunksAccessor = new MapChunksAccessor();
            var mapChanger        = new MapChanger(
                xResolution,
                zResolution,
                MapChunksAccessor);


            for (int i = 0; i < chunksCountX; i++)
            {
                for (int j = 0; j < chunksCountZ; j++)
                {
                    chunks[i, j] = CreateTerrainChunk(i, j, mapChanger, MapChunksAccessor, new Vector2(i * chunkSizeX * meshScale, j * chunkSizeZ * meshScale), chunkSizeX, chunkSizeZ);
                }
            }

            MapChunksAccessor.Recalculate(mapChanger);

            var randomMapGenerator = new RandomMapGenerator(mapChanger);

            randomMapGenerator.GenerateFor();

            foreach (var mapChunk in chunks)
            {
                mapChunk.CommitChanges();
            }

            var time2 = stopwatch.ElapsedMilliseconds;

            print("time2 " + time2);
        }