Example #1
0
    static void AddWindow()
    {
        //创建窗口
        CombineMesh window = (CombineMesh)EditorWindow.GetWindow(typeof(CombineMesh), false, "合并Mesh");

        window.Show();
    }
Example #2
0
    void Init()
    {
        if (_positionBuffer1)
        {
            return;
        }

        if (_mesh == null)
        {
            _mesh = new CombineMesh(_shapes);
        }
        else
        {
            _mesh.Rebuild(_shapes);
        }

        _positionBuffer1 = CreateBuffer();
        _positionBuffer2 = CreateBuffer();
        _velocityBuffer1 = CreateBuffer();
        _velocityBuffer2 = CreateBuffer();
        _rotationBuffer1 = CreateBuffer();
        _rotationBuffer2 = CreateBuffer();

        _kernelMaterial = CreateMaterial(_kernelShader);

        InitializeAndPrewarmBuffers();
    }
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        CombineMesh _combineMesh = (CombineMesh)target;

        if (GUILayout.Button("CombineMesh"))
        {
            _combineMesh.CombineMeshInitiate();
        }
    }
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        if (GUILayout.Button("Combine mesh"))
        {
            CombineMesh cm = (CombineMesh)target;
            cm.CombineMeshes();
        }

        if (GUILayout.Button("Destroy child renderers"))
        {
            CombineMesh cm = (CombineMesh)target;
            cm.RemoveChildRenderers();
        }
    }
Example #5
0
		// Use this for initialization
		void Start () {
            state = mapStates.WaitforReset;
            combineMesh = gameObject_map.GetComponent<CombineMesh>();
            mapdynamicloading = gameObject_map.GetComponent<MapDynamicLoading>();
            eachChunckSize = combineMesh.ChunkSize;

            SecondsOfWaitReset = mapdynamicloading.originTimeToReset;
            timeOfReset = mapdynamicloading.originTimeToReset;
            SecondsOfWaitCollapse = mapdynamicloading.originTimeToCollapse;
            timeOfCollapse = mapdynamicloading.originTimeToReset + mapdynamicloading.originTimeToCollapse;
            SecondsOfCollapse = mapdynamicloading.originTimeToCFinish;
            timeOfFinishCollapse = mapdynamicloading.originTimeToReset + mapdynamicloading.originTimeToCollapse + mapdynamicloading.originTimeToCFinish;

            circle_green.SetActive(false);
            circle_red.SetActive(false);
            GameOver.SetActive(false);
        }
Example #6
0
        // Use this for initialization
        void Start()
        {
            combineMesh = GetComponent <CombineMesh>();

            numOfChunk    = combineMesh.ChunkCount;
            maxX          = combineMesh.Chunk_X_Max;
            maxZ          = combineMesh.Chunk_Z_Max;
            eachChunkSize = combineMesh.ChunkSize;
            visibleChunk  = visibleScope / eachChunkSize;
            lengthOfMap   = maxX * eachChunkSize;
            widthOfMap    = maxZ * eachChunkSize;

            //----------------------------安全区-------------------------------------

            timeToFall = new float[maxX, maxZ];
            floor      = InitializeMap();
            InitializeFallTime(floor);
            Array.Sort(floor);

            //----------------------------动态加载-----------------------------------

            //player = GameObject.FindGameObjectsWithTag ("Player");
            //			foreach (GameObject p in player) {
            //				if (p.GetComponent<PhotonView> ().isMine) {
            //					mine = p;
            //					break;
            //				}
            //			}
            mine = PlayerManager.LocalPlayerInstance;

            mapChunk = new GameObject[maxX, maxZ];
            flag     = new int[maxX, maxZ];

            GetObjectPosition(mine, out nowX, out nowZ);

            CreateChunk(nowX, nowZ);
            lastX = nowX;
            lastZ = nowZ;
        }