コード例 #1
0
        private void Display3dModelSelection(int selectedIdx)
        {
            if (goModel)
            {
                Object.Destroy(goModel);
                goModel = null;
            }

            // Position camera and set model id
            uint modelId = 0;

            if (housesForSale == null)
            {
                camera.transform.position = new Vector3(0, 12, DaggerfallBankManager.GetShipCameraDist((ShipType)selectedIdx));
                modelId = DaggerfallBankManager.GetShipModelId((ShipType)selectedIdx);
            }
            else
            {
                camera.transform.position = new Vector3(0, 3, -20);
                BuildingSummary house = housesForSale[selectedIdx];
                modelId = house.ModelID;
            }

            // Inject custom GameObject if available else create standard mesh game object for the model
            goModel = MeshReplacement.ImportCustomGameobject(modelId, goBankPurchase.transform, new Matrix4x4());
            if (goModel == null)
            {
                goModel = GameObjectHelper.CreateDaggerfallMeshGameObject(modelId, goBankPurchase.transform);
            }

            goModel.layer = layer;

            // Apply current climate
            ClimateBases   climateBase = ClimateSwaps.FromAPIClimateBase(GameManager.Instance.PlayerGPS.ClimateSettings.ClimateType);
            ClimateSeason  season      = (DaggerfallUnity.WorldTime.Now.SeasonValue == DaggerfallDateTime.Seasons.Winter) ? ClimateSeason.Winter : ClimateSeason.Summer;
            DaggerfallMesh dfMesh      = goModel.GetComponent <DaggerfallMesh>();

            dfMesh.SetClimate(climateBase, season, WindowStyle.Day);
        }