private void spawnObject()
        {
            LBD lbd = ResourceManager.Load <LBD>(PathUtil.Combine(Application.streamingAssetsPath, "original", "STG00",
                                                                  "M000.LBD"));

            var texSetOpts = TextureSetOptions.GetFromLBDPath(
                PathUtil.Combine(Application.streamingAssetsPath, "original", "STG00"),
                Shader.Find("LSDR/ClassicDiffuse"),
                Shader.Find("LSDR/RevampedDiffuse"));
            Material mat = new Material(DreamSystem.GetShader(alpha: false));

            DreamSystem.TextureSetSystem.RegisterMaterial(mat, texSetOpts);
            InteractiveObject.Create(lbd, 0, mat, "Head guy", 1, false, "lua/test.lua");
        }
        public void LoadLBD(string lbdFolder, LegacyTileMode tileMode, int lbdWidth)
        {
            lbdFolder = PathUtil.Combine(Application.streamingAssetsPath, lbdFolder);

            TextureSetSystem.DeregisterMaterial(LBDDiffuse);
            TextureSetSystem.DeregisterMaterial(LBDAlpha);
            TextureSetSystem.RegisterMaterial(LBDDiffuse,
                                              TextureSetOptions.GetFromLBDPath(lbdFolder, Classic, Revamped));
            TextureSetSystem.RegisterMaterial(LBDAlpha,
                                              TextureSetOptions.GetFromLBDPath(lbdFolder, ClassicAlpha, RevampedAlpha));

            GameObject lbdRenderer  = new GameObject("LBD Renderer");
            LBDTileMap tileMap      = lbdRenderer.AddComponent <LBDTileMap>();
            GameObject lbdColliders = new GameObject("LBD Colliders");

            string[] lbdFiles = Directory.GetFiles(lbdFolder, "*.LBD", SearchOption.AllDirectories);
            LBDColliders = new GameObject[lbdFiles.Length];
            for (int i = 0; i < lbdFiles.Length; i++)
            {
                string lbdFile = lbdFiles[i];

                Vector3 posOffset = Vector3.zero;
                if (tileMode == LegacyTileMode.Horizontal)
                {
                    int xPos = i % lbdWidth;
                    int yPos = i / lbdWidth;
                    int xMod = 0;
                    if (yPos % 2 == 1)
                    {
                        xMod = 10;
                    }

                    posOffset = new Vector3(xPos * 20 - xMod, 0, yPos * 20);
                }

                LBD        lbd         = ResourceManager.Load <LBD>(lbdFile);
                GameObject lbdCollider = createLBDTileMap(lbd, posOffset, tileMap.TileCache);
                lbdCollider.transform.SetParent(lbdColliders.transform);
                LBDColliders[i] = lbdCollider;
            }

            foreach (var m in tileMap.TileCache.Values)
            {
                m.Submit();
            }
        }
Beispiel #3
0
        private void spawnObject()
        {
            if (SpawnedObject != null)
            {
                return;
            }

            var lbdPath    = PathUtil.Combine(Application.streamingAssetsPath, LBDFile);
            LBD lbd        = ResourceManager.Load <LBD>(lbdPath, "scene");
            var texSetOpts = TextureSetOptions.GetFromLBDPath(Path.GetDirectoryName(lbdPath),
                                                              Shader.Find("LSDR/ClassicDiffuse"),
                                                              Shader.Find("LSDR/RevampedDiffuse"));
            Material mat = new Material(DreamSystem.GetShader(alpha: false));

            DreamSystem.TextureSetSystem.RegisterMaterial(mat, texSetOpts);
            SpawnedObject =
                InteractiveObject.Create(lbd, EntityNumber, mat, EntityID, IdleAnimation, PlayIdleAnimation, LuaScript);
            SpawnedObject.transform.position = transform.position;
        }
Beispiel #4
0
        public void CreateObject()
        {
            if (SpawnedObject != null)
            {
                return;
            }

            var lbdPath    = PathUtil.Combine(Application.streamingAssetsPath, LBDFile);
            LBD lbd        = ResourceManager.Load <LBD>(lbdPath, "scene");
            var texSetOpts = TextureSetOptions.GetFromLBDPath(Path.GetDirectoryName(lbdPath),
                                                              Shader.Find("LSDR/ClassicDiffuse"),
                                                              Shader.Find("LSDR/RevampedDiffuse"));
            Material     mat = new Material(Shader.Find("LSDR/RevampedDiffuse"));
            TIXTexture2D tex = ResourceManager.Load <TIXTexture2D>(texSetOpts.APath);

            mat.mainTexture = tex;
            SpawnedObject   =
                InteractiveObject.Create(lbd, EntityNumber, mat, EntityID, IdleAnimation, PlayIdleAnimation, LuaScript);
            SpawnedObject.transform.SetParent(transform);
            SpawnedObject.transform.localPosition = Vector3.zero;
        }