Пример #1
0
    public void UpdateTerrainChunk()
    {
        if (mHeightMap.sampleCenter == mSampleCenter)
        {
            int lod = mTerrain.lod;

            LODMesh lodMesh = mLODMeshes[lod];

            if (lodMesh.mesh != null && lodMesh.sampleCenter == mHeightMap.sampleCenter)
            {
                mMeshFilter.mesh = lodMesh.mesh;

                var matrix4x4 = mMeshObject.transform.localToWorldMatrix;

                ThreadQueue.RunAsync(() => GenerateTree(matrix4x4, lod));
            }
            else
            {
                lodMesh.GenerateMesh(mHeightMap, mTerrain.meshSettings);
            }
        }
        else
        {
            Load();
        }
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        Instance = this;

        CameraManager.Instance.Init();

        AssetLoader.LoadAsset <TextAsset>("data.bytes", (asset) =>
        {
            if (asset != null)
            {
                byte[] bytes = asset.assetObject.bytes;

                //启动线程加载
                ThreadQueue.RunAsync(() => DataTableManager.Instance.Init(bytes),
                                     () => {
                    if (grid == BattleGrid.Rect)
                    {
                        BattleRectGrid.Instance.Init(transform, lines, columns, tileWidth, tileHeight);
                    }
                    else
                    {
                        BattleHexGrid.Instance.Init(transform, shape, lines, columns, Mathf.Max(tileWidth, tileHeight), orientation);
                    }

                    asset.Destroy();
                });
            }
        });
    }
Пример #3
0
 public void Load()
 {
     if (mRequestingHeightMap == false)
     {
         mRequestingHeightMap = true;
         ThreadQueue.RunAsync(() => mHeightMap.GenerateHeightMap(mTerrain.heightMapSettings, mSampleCenter), OnHeightMapReceived);
     }
 }
Пример #4
0
 public void GenerateMesh(HeightMap heightMap, MeshSettings meshSettings)
 {
     if (mRequestingMesh == false || sampleCenter != heightMap.sampleCenter)
     {
         sampleCenter    = heightMap.sampleCenter;
         mRequestingMesh = true;
         ThreadQueue.RunAsync(() => heightMap.GenerateMeshData(meshSettings, lod), OnMeshDataReceived);
     }
 }
Пример #5
0
    void Start()
    {
        var task = AssetLoader.LoadScene("testscene.unity", LoadSceneMode.Additive, (scene, mode) =>
        {
            mScene = scene;
        });

        task.isCancel = true;

        //return;

        AssetLoader.LoadAsset <TextAsset>("data.bytes", (asset) =>
        {
            if (asset != null)
            {
                byte[] bytes = asset.assetObject.bytes;

                //启动线程加载
                ThreadQueue.RunAsync(() => DataTableManager.Instance.Init(bytes),
                                     () => {
                    asset.Destroy();
                });
            }
        });

        AssetLoader.LoadAsset <GameObject>("cube.prefab", (asset) => {
            if (asset != null)
            {
                Debug.Log("Load Success:cube.prefab!");
                asset.Destroy();
            }
            else
            {
                Debug.Log("Load Failed:cube.prefab!");
            }
        });



        AssetLoader.LoadAsset <GameObject>("cube1.prefab", (asset) =>
        {
            if (asset != null)
            {
                Debug.Log("Load Success:cube1.prefab!");
            }
            else
            {
                Debug.Log("Load Failed:cube1.prefab!");
            }
        });
        //task.isCancel = true;

        Instance = this;

        CameraManager.Instance.Init();

        mEntity          = ObjectPool.GetInstance <BattleEntity>();
        mEntity.id       = 1;
        mEntity.position = Vector3.zero;
        mEntity.config   = "yingxiong_kulouqishi.txt";
        mEntity.properties.SetProperty <float>((uint)PropertyID.PRO_MOVE_SPEED, 6);

        BattleManager.Instance.AddEntity(mEntity);
        mEntity.active = true;

        mEntity1          = ObjectPool.GetInstance <BattleEntity>();
        mEntity1.id       = 2;
        mEntity1.position = new Vector3(10, 0, 0);
        mEntity1.config   = "nvjiangjun.txt";

        BattleManager.Instance.AddEntity(mEntity1);
        mEntity1.active = true;

        EventSystem.Instance.AddListener(1, 1, 0, OnListen);
        EventSystem.Instance.Invoke(1, 1, 0);

        EventListener listener = new EventListener();

        listener.AddListener((Action)OnListen);
        listener.Invoke();
        listener.AddListener((Action <int>)OnListen);
        listener.Invoke(1);
    }