コード例 #1
0
ファイル: TerrainManager.cs プロジェクト: Project-Seed/Seed
 public void CallTerrainManager()
 {
     if (loader = GameObject.Find(GameSystem.instance.map_name).GetComponent <TerrainLoader>())
     {
         loader.LoadUnLoad();
     }
 }
コード例 #2
0
 void Start()
 {
     Nbutton.onClick.AddListener(() => updateNSbutton("N"));
     Sbutton.onClick.AddListener(() => updateNSbutton("S"));
     Ebutton.onClick.AddListener(() => updateEWbutton("E"));
     Wbutton.onClick.AddListener(() => updateEWbutton("W"));
     S0button.onClick.AddListener(() => updateShardButton("shard0"));
     S1button.onClick.AddListener(() => updateShardButton("shard1"));
     S2button.onClick.AddListener(() => updateShardButton("shard2"));
     S3button.onClick.AddListener(() => updateShardButton("shard3"));
     EWslider.onValueChanged.AddListener(delegate { updateEWslider(); });
     NSslider.onValueChanged.AddListener(delegate { updateNSslider(); });
     GetRoomButton.onClick.AddListener(() => GoToRoom());
     //EW = "E";
     //NS = "N";
     EWnum = "0";
     NSnum = "0";
     Ebutton.onClick.Invoke();
     Sbutton.onClick.Invoke();
     S1button.onClick.Invoke();
     //shard = "shard1";
     //updateRoomName();
     //updateShardName();
     //roomName = ConnectionController.roomName;
     lastRoomName = ConnectionController.roomName;
     terrLoader   = GameObject.Find("TileMapHolder").GetComponent <TerrainLoader>();
     objectLoader = GameObject.Find("TileMapHolder").GetComponent <ObjectsLoader>();
     mapLoader    = gameObject.GetComponent <MapLoader>();
     grid         = objectLoader.grid;
     touchStart   = Vector3.zero;
     DetailsScrollView.SetActive(false);
     lastTime = 0;
 }
コード例 #3
0
    private void LoadNeededTerrain()
    {
        if (NightLoadingMode == Mode.DayOnly)
        {
            dayTerrainLoader = TerrainLoader.Instance;
            dayTerrainLoader.TerrainFullyLoaded += DayTerrainLoaded;
        }
        else if (NightLoadingMode == Mode.NightOnly)
        {
            nightTerrainLoader = TerrainLoader.Instance;
            nightTerrainLoader.TerrainFullyLoaded += NightTerrainLoaded;
        }
        else if (NightLoadingMode == Mode.Dual)
        {
            dayTerrainLoader = TerrainLoader.Instance;
            dayTerrainLoader.TerrainFullyLoaded += DayTerrainLoaded;

            var dayTerrainPath   = dayTerrainLoader.TerrainBundlePath;
            var nightTerrainPath = dayTerrainPath + "_night";

            if (File.Exists(nightTerrainPath))
            {
                nightTerrainLoader = TerrainLoader.Instance;
                nightTerrainLoader.TerrainLoadingCanvasPrefab = dayTerrainLoader.TerrainLoadingCanvasPrefab;
                nightTerrainLoader.TerrainBundlePath          = nightTerrainPath;
                nightTerrainLoader.TerrainFullyLoaded        += NightTerrainLoaded;
            }
        }
    }
コード例 #4
0
 protected virtual void Awake()
 {
     if (null == Instance)
     {
         Instance = this;
     }
 }
コード例 #5
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        if (availableTerrains == null)
        {
            availableTerrains = new Dictionary <string, string>();
            availableTerrains["TerrainName"] = @"C:\DB\Unity\TerrainName";
        }

        TerrainLoader targetTerrainLoader = (TerrainLoader)target;

        DrawDefaultInspector();

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Available Terrains:");

        foreach (var terrain in availableTerrains)
        {
            if (GUILayout.Button(terrain.Key))
            {
                serializedObject.FindProperty("TerrainBundlePath").stringValue = terrain.Value;
                serializedObject.ApplyModifiedProperties();
            }
        }
    }
コード例 #6
0
        public static void FinalizePlayerObjectEditor(GameObject playerObj, GaiaSettings gaiaSettings)
        {
            if (playerObj != null)
            {
                playerObj.transform.SetParent(GaiaUtils.GetPlayerObject().transform);
                #if UNITY_EDITOR
                //Adjust the scene view to see the camera
                if (SceneView.lastActiveSceneView != null)
                {
                    if (gaiaSettings.m_focusPlayerOnSetup)
                    {
                        SceneView.lastActiveSceneView.LookAtDirect(playerObj.transform.position, playerObj.transform.rotation);
                    }
                }
                #endif
            }

            GaiaSessionManager session = GaiaSessionManager.GetSessionManager();
            if (session != null)
            {
                if (session.m_session != null)
                {
                    if (playerObj.transform.position.y < session.m_session.m_seaLevel)
                    {
                        playerObj.transform.position = new Vector3(playerObj.transform.position.x, session.m_session.m_seaLevel + 5f, playerObj.transform.position.z);
                    }
                }
            }

#if GAIA_PRO_PRESENT
            //Add the simple terrain culling script, useful in any case
            if (GaiaUtils.CheckIfSceneProfileExists())
            {
                GaiaGlobal.Instance.SceneProfile.m_terrainCullingEnabled = true;
            }
#endif

            bool dynamicLoadedTerrains = GaiaUtils.HasDynamicLoadedTerrains();
            if (dynamicLoadedTerrains)
            {
#if GAIA_PRO_PRESENT
                TerrainLoader loader = playerObj.GetComponent <TerrainLoader>();
                if (loader == null)
                {
                    loader = playerObj.AddComponent <TerrainLoader>();
                }
                loader.LoadMode = LoadMode.RuntimeAlways;
                float tileSize = 512;
                if (TerrainLoaderManager.Instance.TerrainSceneStorage.m_terrainTilesSize > 0)
                {
                    tileSize = TerrainLoaderManager.Instance.TerrainSceneStorage.m_terrainTilesSize;
                }
                float size = tileSize * 1.25f * 2f;
                loader.m_loadingBoundsRegular  = new BoundsDouble(playerObj.transform.position, new Vector3(size, size, size));
                loader.m_loadingBoundsImpostor = new BoundsDouble(playerObj.transform.position, new Vector3(size * 3f, size * 3f, size * 3f));
                loader.m_loadingBoundsCollider = new BoundsDouble(playerObj.transform.position, new Vector3(size, size, size));
#endif
            }
        }
コード例 #7
0
 public static void LoadGraphicsAssetsFromFiles(Ruleset ruleset, Rules rules)
 {
     TerrainLoader.LoadTerrain(ruleset, rules);
     UnitLoader.LoadUnits(ruleset);
     LoadIcons(ruleset);
     LoadPeopleIcons(ruleset);
     LoadCityWallpaper(ruleset);
 }
コード例 #8
0
        private void TerrainLoadingSettings(bool helpEnabled)
        {
#if GAIA_PRO_PRESENT
            EditorGUI.BeginChangeCheck();
            if (!TerrainLoaderManager.Instance.TerrainSceneStorage.m_terrainLoadingEnabled)
            {
                EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("AutoLoadTerrainsDisabled"), MessageType.Warning);
                GUI.enabled = false;
            }

            if (TerrainLoaderManager.ColliderOnlyLoadingActive)
            {
                EditorGUILayout.HelpBox(m_editorUtils.GetTextValue("ColliderOnlyLoadingWarning"), MessageType.Warning);
            }

            m_profile.m_terrainLoaderLoadMode = (LoadMode)m_editorUtils.EnumPopup("LoadMode", m_profile.m_terrainLoaderLoadMode, helpEnabled);
            if (m_profile.m_terrainLoaderLoadMode == LoadMode.RuntimeAlways)
            {
                EditorGUI.indentLevel++;
                m_editorUtils.InlineHelp("RefreshRates", helpEnabled);
                m_profile.m_terrainLoaderMinRefreshDistance = m_editorUtils.FloatField("MinRefreshDistance", m_profile.m_terrainLoaderMinRefreshDistance, helpEnabled);
                m_profile.m_terrainLoaderMaxRefreshDistance = m_editorUtils.FloatField("MaxRefreshDistance", m_profile.m_terrainLoaderMaxRefreshDistance, helpEnabled);
                m_profile.m_terrainLoaderMinRefreshMS       = m_editorUtils.FloatField("MinRefreshMS", m_profile.m_terrainLoaderMinRefreshMS, helpEnabled);
                m_profile.m_terrainLoaderMaxRefreshMS       = m_editorUtils.FloatField("MaxRefreshMS", m_profile.m_terrainLoaderMaxRefreshMS, helpEnabled);
                EditorGUI.indentLevel--;
            }
            m_editorUtils.Heading("LoadRange");
            EditorGUI.indentLevel++;
            m_profile.m_terrainLoaderFollowTransform = m_editorUtils.Toggle("FollowTransform", m_profile.m_terrainLoaderFollowTransform, helpEnabled);
            if (TerrainLoaderManager.ColliderOnlyLoadingActive)
            {
                if (!m_profile.m_terrainLoaderFollowTransform)
                {
                    m_profile.m_terrainLoaderLoadingBoundsCollider.center = m_editorUtils.Vector3Field("LoadingBoundsColliderCenter", m_profile.m_terrainLoaderLoadingBoundsCollider.center, helpEnabled);
                }
                m_profile.m_terrainLoaderLoadingBoundsCollider.extents = m_editorUtils.Vector3Field("LoadingBoundsColliderExtents", m_profile.m_terrainLoaderLoadingBoundsCollider.extents, helpEnabled);
            }
            else
            {
                if (!m_profile.m_terrainLoaderFollowTransform)
                {
                    m_profile.m_terrainLoaderLoadingBoundsRegular.center = m_editorUtils.Vector3Field("LoadingBoundsCenter", m_profile.m_terrainLoaderLoadingBoundsRegular.center, helpEnabled);
                }
                m_profile.m_terrainLoaderLoadingBoundsRegular.extents = m_editorUtils.Vector3Field("LoadingBoundsExtents", m_profile.m_terrainLoaderLoadingBoundsRegular.extents, helpEnabled);
                if (!m_profile.m_terrainLoaderFollowTransform)
                {
                    m_profile.m_terrainLoaderLoadingBoundsImpostor.center = m_editorUtils.Vector3Field("LoadingBoundsImpostorCenter", m_profile.m_terrainLoaderLoadingBoundsImpostor.center, helpEnabled);
                }
                m_profile.m_terrainLoaderLoadingBoundsImpostor.extents = m_editorUtils.Vector3Field("LoadingBoundsImpostorExtents", m_profile.m_terrainLoaderLoadingBoundsImpostor.extents, helpEnabled);
            }
            EditorGUI.indentLevel--;
            if (EditorGUI.EndChangeCheck())
            {
                TerrainLoader tl = ((GaiaScenePlayer)target).GetComponentInChildren <TerrainLoader>();
                m_profile.UpdateTerrainLoaderFromProfile(ref tl);
            }
#endif
        }
コード例 #9
0
ファイル: LoaderUI.cs プロジェクト: adshavd/VworldToUnity
    /// <summary>
    /// Implementation of user interface.
    /// </summary>
    private void OnGUI()
    {
        int offset = 0;

        LoadDataArea   = new Rect(3, offset += 0, position.width - 6, 120);
        RenderDataArea = new Rect(3, offset += 120, position.width - 6, 130);

        // fixed window size
        GUILayout.ExpandHeight(false);
        GUILayout.ExpandWidth(false);

        #region Load Data
        GUILayout.BeginArea(LoadDataArea);
        apiKey = EditorGUILayout.TextField("Api Key", apiKey);
        lat    = EditorGUILayout.FloatField("Latitude", lat);
        lon    = EditorGUILayout.FloatField("Longitude", lon);
        rad    = EditorGUILayout.IntSlider("Radius", rad, 1000, 60000);
        level  = EditorGUILayout.IntSlider("Level", level, 7, 15);
        if (GUILayout.Button("Load Data"))
        {
            generator = new TerrainLoader(apiKey);
            generator.Init(lat, lon, rad, level);
            generator.Generate();
        }
        if (generator != null)
        {
            Progress = generator.GetProgressStatus();
        }
        else
        {
            Progress = 0;
        }
        GUILayout.EndArea();
        #endregion

        #region Render Data
        GUILayout.BeginArea(RenderDataArea);
        minIndex   = EditorGUILayout.Vector2IntField("MinIndex", minIndex);
        maxIndex   = EditorGUILayout.Vector2IntField("MaxIndex", maxIndex);
        Resolution = EditorGUILayout.IntSlider("Resolution", Resolution, 32, 1024);
        Height     = EditorGUILayout.IntSlider("Height", Height, 1, 100);
        if (GUILayout.Button("Render Data"))
        {
            renderer = new TerrainRenderer();
            renderer.Init(minIndex.x, minIndex.y, maxIndex.x, maxIndex.y, resolution, Height);
            renderer.Run();
        }
        GUILayout.EndArea();
        #endregion

        EditorGUI.ProgressBar(new Rect(3, position.height - 24, position.width - 6, 20), Progress, (Progress * 100).ToString());
    }
コード例 #10
0
 public void UpdateTerrainLoaderFromProfile(ref TerrainLoader tl)
 {
     if (GaiaUtils.HasDynamicLoadedTerrains())
     {
         if (tl != null)
         {
             tl.LoadMode                = m_terrainLoaderLoadMode;
             tl.m_minRefreshDistance    = m_terrainLoaderMinRefreshDistance;
             tl.m_maxRefreshDistance    = m_terrainLoaderMaxRefreshDistance;
             tl.m_minRefreshMS          = m_terrainLoaderMinRefreshMS;
             tl.m_maxRefreshMS          = m_terrainLoaderMaxRefreshMS;
             tl.m_followTransform       = m_terrainLoaderFollowTransform;
             tl.m_loadingBoundsRegular  = m_terrainLoaderLoadingBoundsRegular;
             tl.m_loadingBoundsImpostor = m_terrainLoaderLoadingBoundsImpostor;
             tl.m_loadingBoundsCollider = m_terrainLoaderLoadingBoundsCollider;
         }
     }
 }
コード例 #11
0
        public static void FinalizePlayerObjectRuntime(GameObject playerObj)
        {
            GaiaSessionManager session = GaiaSessionManager.GetSessionManager();

            if (session != null)
            {
                if (session.m_session != null)
                {
                    if (playerObj.transform.position.y < session.m_session.m_seaLevel)
                    {
                        playerObj.transform.position = new Vector3(playerObj.transform.position.x, session.m_session.m_seaLevel + 5f, playerObj.transform.position.z);
                    }
                }
            }

#if GAIA_PRO_PRESENT
            //Add the simple terrain culling script, useful in any case
            if (GaiaUtils.CheckIfSceneProfileExists())
            {
                GaiaGlobal.Instance.SceneProfile.m_terrainCullingEnabled = true;
            }
#endif

            bool dynamicLoadedTerrains = GaiaUtils.HasDynamicLoadedTerrains();
            if (dynamicLoadedTerrains)
            {
#if GAIA_PRO_PRESENT
                Terrain       terrain = TerrainHelper.GetActiveTerrain();
                TerrainLoader loader  = playerObj.GetComponent <TerrainLoader>();
                if (loader == null)
                {
                    loader = playerObj.AddComponent <TerrainLoader>();
                }
                loader.LoadMode = LoadMode.RuntimeAlways;
                float size = terrain.terrainData.size.x * 1.25f * 2f;
                loader.m_loadingBoundsRegular  = new BoundsDouble(playerObj.transform.position, new Vector3(size, size, size));
                loader.m_loadingBoundsImpostor = new BoundsDouble(playerObj.transform.position, new Vector3(size * 3f, size * 3f, size * 3f));
#endif
            }
        }
コード例 #12
0
 public SimpleWDTTerrain(MapId mapId, TerrainLoader loader, bool loadOnDemand) : base(mapId, loader, loadOnDemand)
 {
     Init(mapId);
 }
コード例 #13
0
        public static void Load(
            SceneList scenes,
            SceneInterface scene,
            LoadOptions options,
            Stream inputFile,
            TTY io = null)
        {
            var currentLoadState = CurrentOarLoadState.Unknown;

            using (var gzipStream = new GZipStream(inputFile, CompressionMode.Decompress))
            {
                using (var reader = new TarArchiveReader(gzipStream))
                {
                    var baseLoc = new GridVector(0, 0);
                    if (scene != null)
                    {
                        baseLoc = scene.GridPosition;
                    }

                    var  regionSize     = new GridVector(256, 256);
                    var  regionMapping  = new Dictionary <string, ArchiveXmlLoader.RegionInfo>();
                    var  regionInfos    = new List <ArchiveXmlLoader.RegionInfo>();
                    bool parcelsCleared = false;
                    var  load_sogs      = new List <ObjectGroup>();

                    for (; ;)
                    {
                        TarArchiveReader.Header header;
                        try
                        {
                            header = reader.ReadHeader();
                        }
                        catch (TarArchiveReader.EndOfTarException)
                        {
                            if ((options & LoadOptions.Merge) == 0 && scene != null)
                            {
                                scene.ClearObjects();
                            }

                            AddObjects(scene, load_sogs, options);
                            return;
                        }

                        if (header.FileType == TarFileType.File)
                        {
                            if (header.FileName == "archive.xml")
                            {
                                ArchiveXmlLoader.RegionInfo rinfo = ArchiveXmlLoader.LoadArchiveXml(new ObjectXmlStreamFilter(reader), regionInfos);

                                regionSize = rinfo.RegionSize;
                                foreach (ArchiveXmlLoader.RegionInfo reginfo in regionInfos)
                                {
                                    regionMapping.Add(reginfo.Path, reginfo);
                                }
                                if (regionInfos.Count != 0 && scene != null)
                                {
                                    throw new MultiRegionOARLoadingTriedOnRegionException();
                                }
                                else if (regionInfos.Count == 0 && scene == null)
                                {
                                    throw new OARLoadingTriedWithoutSelectedRegionException();
                                }
                            }
                            else if (header.FileName.StartsWith("assets/"))
                            {
                                if ((options & LoadOptions.NoAssets) == 0)
                                {
                                    ShowOarLoadState(ref currentLoadState, CurrentOarLoadState.Assets, io);
                                    /* Load asset */
                                    AssetData ad = reader.LoadAsset(header, scene.Owner);
                                    if (!scene.AssetService.Exists(ad.ID))
                                    {
                                        scene.AssetService.Store(ad);
                                    }
                                }
                            }
                            else
                            {
                                if (header.FileName.StartsWith("regions/"))
                                {
                                    ShowOarLoadState(ref currentLoadState, CurrentOarLoadState.Region, io);
                                    if ((options & LoadOptions.Merge) == 0 && scene != null)
                                    {
                                        scene.ClearObjects();
                                    }

                                    if (scene != null)
                                    {
                                        AddObjects(scene, load_sogs, options);
                                    }

                                    string[] pcomps = header.FileName.Split(new char[] { '/' }, 3);
                                    if (pcomps.Length < 3)
                                    {
                                        throw new OARFormatException();
                                    }
                                    string regionname = pcomps[1];
                                    header.FileName = pcomps[2];
                                    regionSize      = regionMapping[regionname].RegionSize;
                                    scene           = scenes[regionMapping[regionname].ID];
                                    parcelsCleared  = false;
                                }

                                if (header.FileName.StartsWith("objects/"))
                                {
                                    ShowOarLoadState(ref currentLoadState, CurrentOarLoadState.Objects, io);
                                    /* Load objects */
                                    List <ObjectGroup>        sogs;
                                    XmlDeserializationOptions xmloptions = XmlDeserializationOptions.ReadKeyframeMotion;
                                    if ((options & LoadOptions.PersistUuids) != 0)
                                    {
                                        xmloptions |= XmlDeserializationOptions.RestoreIDs;
                                    }
                                    try
                                    {
                                        sogs = ObjectXML.FromXml(reader, scene.Owner, xmloptions);
                                    }
                                    catch (Exception e)
                                    {
                                        throw new OARLoadingErrorException("Failed to load sog " + header.FileName, e);
                                    }

                                    foreach (ObjectGroup sog in sogs)
                                    {
                                        if (sog.Owner.ID == UUID.Zero)
                                        {
                                            sog.Owner = scene.Owner;
                                        }
                                    }
                                    load_sogs.AddRange(sogs);
                                }
                                else if (header.FileName.StartsWith("terrains/"))
                                {
                                    ShowOarLoadState(ref currentLoadState, CurrentOarLoadState.Terrain, io);
                                    /* Load terrains */
                                    if ((options & LoadOptions.Merge) == 0)
                                    {
                                        scene.Terrain.AllPatches = TerrainLoader.LoadStream(reader, (int)regionSize.X, (int)regionSize.Y);
                                        scene.StoreTerrainAsDefault();
                                    }
                                }
                                else if (header.FileName.StartsWith("landdata/"))
                                {
                                    ShowOarLoadState(ref currentLoadState, CurrentOarLoadState.Parcels, io);
                                    /* Load landdata */
                                    if ((options & LoadOptions.Merge) == 0)
                                    {
                                        if (!parcelsCleared)
                                        {
                                            scene.ClearParcels();
                                            parcelsCleared = true;
                                        }
                                        var        whiteList = new List <ParcelAccessEntry>();
                                        var        blackList = new List <ParcelAccessEntry>();
                                        ParcelInfo pinfo     = ParcelLoader.GetParcelInfo(new ObjectXmlStreamFilter(reader), regionSize, whiteList, blackList);
                                        if (pinfo.Owner.ID == UUID.Zero)
                                        {
                                            pinfo.Owner = scene.Owner;
                                        }
                                        if ((options & LoadOptions.PersistUuids) == LoadOptions.PersistUuids)
                                        {
                                            ParcelInfo check;
                                            if (scene.Parcels.TryGetValue(pinfo.ID, out check))
                                            {
                                                pinfo.ID = UUID.Random;
                                            }
                                        }
                                        else
                                        {
                                            pinfo.ID = UUID.Random;
                                        }
                                        scene.AddParcel(pinfo);
                                        scene.Parcels.WhiteList.Remove(scene.ID, pinfo.ID);
                                        scene.Parcels.BlackList.Remove(scene.ID, pinfo.ID);
                                        foreach (ParcelAccessEntry pae in whiteList)
                                        {
                                            scene.Parcels.WhiteList.Store(pae);
                                        }
                                        foreach (ParcelAccessEntry pae in blackList)
                                        {
                                            scene.Parcels.BlackList.Store(pae);
                                        }
                                    }
                                }
                                else if (header.FileName.StartsWith("settings/") && ((options & LoadOptions.Merge) == 0))
                                {
                                    ShowOarLoadState(ref currentLoadState, CurrentOarLoadState.Parcels, io);
                                    /* Load settings */
                                    RegionSettingsLoader.LoadRegionSettings(new ObjectXmlStreamFilter(reader), scene);
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #14
0
ファイル: TerrainTrigger.cs プロジェクト: Project-Seed/Seed
 private void Awake()
 {
     loader = GetComponent <TerrainLoader>();
 }
コード例 #15
0
 public SimpleTerrain(MapId mapId, TerrainLoader loader, bool loadOnDemand = true)
     : base(mapId, loadOnDemand)
 {
     Loader = loader;
 }
コード例 #16
0
ファイル: GeometryLoader.cs プロジェクト: coolzoom/MeshViewer
 public static void Initialize(string directory, int mapID)
 {
     Buildings   = new BuildingsLoader(directory, mapID);
     Terrain     = new TerrainLoader(directory, mapID);
     GameObjects = new GameObjectLoader(directory);
 }
コード例 #17
0
 void OnEnable()
 {
     loader       = (TerrainLoader)target;
     Tools.hidden = true;
 }
コード例 #18
0
        private void GlobalSettings(bool helpEnabled)
        {
            if (GaiaGlobal.Instance.SceneProfile.m_lightingProfiles.Count > 0)
            {
                if (m_profile.m_selectedLightingProfileValuesIndex != -99)
                {
                    profile = GaiaGlobal.Instance.SceneProfile.m_lightingProfiles[m_profile.m_selectedLightingProfileValuesIndex];
                }
            }

            if (m_gaiaSettings.m_currentRenderer == GaiaConstants.EnvironmentRenderer.BuiltIn)
            {
                bool postfx = m_profile.m_setupPostFX;
                m_profile.m_setupPostFX = m_editorUtils.Toggle("SetupPostFX", m_profile.m_setupPostFX, helpEnabled);
                if (postfx != m_profile.m_setupPostFX)
                {
                    if (m_profile.m_setupPostFX)
                    {
                        if (profile != null)
                        {
                            GaiaLighting.SetupPostProcessing(profile, m_profile, GaiaUtils.GetActivePipeline(), true);
                        }
                    }
                    else
                    {
                        GaiaLighting.RemoveAllPostProcessV2CameraLayer();
                    }
                }
            }
            m_profile.m_spawnPlayerAtCurrentLocation = m_editorUtils.Toggle("SpawnPlayerAtCurrentLocation", m_profile.m_spawnPlayerAtCurrentLocation, helpEnabled);

            GaiaConstants.EnvironmentControllerType controller = m_profile.m_controllerType;
            controller = (GaiaConstants.EnvironmentControllerType)m_editorUtils.EnumPopup("ControllerType", controller, helpEnabled);
            if (controller != m_profile.m_controllerType)
            {
                m_gaiaSettings.m_currentController = controller;
                switch (controller)
                {
                case GaiaConstants.EnvironmentControllerType.FirstPerson:
                    GaiaSceneManagement.CreatePlayer(m_gaiaSettings, GaiaConstants.playerFirstPersonName, m_profile.m_spawnPlayerAtCurrentLocation, null, null, true);
                    break;

                case GaiaConstants.EnvironmentControllerType.FlyingCamera:
                    GaiaSceneManagement.CreatePlayer(m_gaiaSettings, GaiaConstants.playerFlyCamName, m_profile.m_spawnPlayerAtCurrentLocation, null, null, true);
                    break;

                case GaiaConstants.EnvironmentControllerType.ThirdPerson:
                    GaiaSceneManagement.CreatePlayer(m_gaiaSettings, GaiaConstants.playerThirdPersonName, m_profile.m_spawnPlayerAtCurrentLocation, null, null, true);
                    break;

                case GaiaConstants.EnvironmentControllerType.Car:
                    GaiaSceneManagement.CreatePlayer(m_gaiaSettings, GaiaConstants.m_carPlayerPrefabName, m_profile.m_spawnPlayerAtCurrentLocation, null, null, true);
                    break;

                case GaiaConstants.EnvironmentControllerType.XRController:
#if GAIA_XR
                    GaiaSceneManagement.CreatePlayer(m_gaiaSettings, "XRController", m_profile.m_spawnPlayerAtCurrentLocation);
#else
                    EditorUtility.DisplayDialog("XR Support not enabled", "The XR Controller is a default player for Virtual / Augmented Reality projects. Please open the Setup Panel in the Gaia Manager Standard Tab to enable XR Support in order to use the XR Player Controller. Please also make sure you have the Unity XR Interaction Toolkit package installed before doing so.", "OK");
                    controller = GaiaConstants.EnvironmentControllerType.FlyingCamera;
                    m_gaiaSettings.m_currentController = GaiaConstants.EnvironmentControllerType.FlyingCamera;
#endif
                    break;
                }

                SetPostProcessing(profile);
#if GAIA_PRO_PRESENT
                if (GaiaUtils.HasDynamicLoadedTerrains())
                {
                    TerrainLoader tl = ((GaiaScenePlayer)target).GetComponentInChildren <TerrainLoader>();
                    if (tl != null)
                    {
                        m_profile.UpdateTerrainLoaderFromProfile(ref tl);
                    }
                }
#endif
                m_profile.m_controllerType = controller;
            }

            if (controller == GaiaConstants.EnvironmentControllerType.Custom)
            {
                m_profile.m_customPlayer = (GameObject)m_editorUtils.ObjectField("MainPlayer", m_profile.m_customPlayer, typeof(GameObject), true, helpEnabled);
                m_profile.m_customCamera = (Camera)m_editorUtils.ObjectField("MainCamera", m_profile.m_customCamera, typeof(Camera), true, helpEnabled);

                if (m_editorUtils.Button("ApplySetup"))
                {
                    GaiaSceneManagement.CreatePlayer(m_gaiaSettings, "Custom", m_profile.m_spawnPlayerAtCurrentLocation, m_profile.m_customPlayer, m_profile.m_customCamera, true);
                    SetPostProcessing(profile);
#if GAIA_PRO_PRESENT
                    if (GaiaUtils.HasDynamicLoadedTerrains())
                    {
                        TerrainLoader tl = ((GaiaScenePlayer)target).GetComponentInChildren <TerrainLoader>();
                        if (tl != null)
                        {
                            m_profile.UpdateTerrainLoaderFromProfile(ref tl);
                        }
                    }
#endif
                }
            }

            EditorGUILayout.BeginHorizontal();

            if (m_editorUtils.Button("MoveCameraToPlayer"))
            {
                GaiaSceneManagement.MoveCameraToPlayer(m_gaiaSettings);
            }

            if (m_editorUtils.Button("MovePlayerToCamera"))
            {
                GaiaSceneManagement.MovePlayerToCamera(m_gaiaSettings);
            }

            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();
            m_editorUtils.Panel("AutoDepthOfFieldSettings", AutoDepthOfField);
            m_editorUtils.Panel("LocationManagerSettings", LocationManagerSettings);
            m_editorUtils.Panel("PlayerCameraCullingSettings", CameraCullingSettings);
            if (GaiaUtils.HasDynamicLoadedTerrains())
            {
                m_editorUtils.Panel("TerrainLoadingSettings", TerrainLoadingSettings);
            }
        }
コード例 #19
0
ファイル: SimpleTerrain.cs プロジェクト: KroneckerX/WCell
 public SimpleTerrain(MapId mapId, TerrainLoader loader, bool loadOnDemand = true)
     : base(mapId, loadOnDemand)
 {
     Loader = loader;
 }
コード例 #20
0
    void OnGUI()
    {
        if (showTextCuriosityLocationInfo)
        {
            // ?? objCuriosity = CuriosityControl.GetComponent();
            // objCuriosity = GameObject.Find("Your_Name_Here").transform.position;
            // objCuriosity = GameObject.FindGameObjectWithTag("Your_Tag_Here").transform.position;

            // GameObject objCuriosity = GameObject.Find("Curiosity");
            // Vector3 vectPosXYZ = objCuriosity.transform.position;
            //int zoom = 5;
            // Debug.Log (vectPosXYZ);
            // GUI.Label(textAreaCuriosityLocationInfo,"Line1\nLine2\nLine3\nLine4");

            // GUI.Label( textAreaCuriosityLocationInfo, prepareTextLine_from_vectPosXYZ( vectPosXYZ, zoom ) + "\n" );

            string text_overlay = "";
            // http://stackoverflow.com/questions/28759545/unity-an-object-reference-is-required-to-access-non-static-member-ray-cast-to
            // DID NOT WORK: TerrainLoader objTerrainLoader = GetComponent<TerrainLoader>();
            // DID NOT WORK: TerrainLoader objTerrainLoader = GameObject.Find("TerrainLoader");

            Vector2 vectLonxLaty = TerrainLoader.getLonxLaty_of_Curiosity();

            // text_overlay += TerrainLoader.glob_obj_il.event_name + "\n";

            text_overlay += "Lon: " + vectLonxLaty.x.ToString("###0.000000") + "E " + "\n"
                            + "Lat: " + vectLonxLaty.y.ToString("###0.000000") + "N " + "\n";
            GUI.Label(textAreaCuriosityLocationInfo, text_overlay);


            /*
             * GUI.Label( textAreaCuriosityLocationInfo,
             *        prepareTextLine_from_vectPosXYZ( new Vector3( 0*256, 0, 0*256 ), 0 ) + "\n"
             + prepareTextLine_from_vectPosXYZ( new Vector3( 1*256, 0, 0*256 ), 0 ) + "\n"
             + prepareTextLine_from_vectPosXYZ( new Vector3( 2*256, 0, 0*256 ), 0 ) + "\n"
             + prepareTextLine_from_vectPosXYZ( new Vector3( 0*256, 0, 1*256 ), 0 ) + "\n"
             + prepareTextLine_from_vectPosXYZ( new Vector3( 1*256, 0, 1*256 ), 0 ) + "\n"
             + prepareTextLine_from_vectPosXYZ( new Vector3( 2*256, 0, 1*256 ), 0 ) + "\n"
             + );
             */
            /*
             * GUI.Label( textAreaCuriosityLocationInfo,
             *      prepareTextLine_from_vectPosXYZ( new Vector3( 0*256, 0, 0*256 ), 1 ) + "\n"
             + prepareTextLine_from_vectPosXYZ( new Vector3( 1*256, 0, 0*256 ), 1 ) + "\n"
             + prepareTextLine_from_vectPosXYZ( new Vector3( 2*256, 0, 0*256 ), 1 ) + "\n"
             + prepareTextLine_from_vectPosXYZ( new Vector3( 3*256, 0, 0*256 ), 1 ) + "\n"
             + prepareTextLine_from_vectPosXYZ( new Vector3( 4*256, 0, 0*256 ), 1 ) + "\n"
             +
             + prepareTextLine_from_vectPosXYZ( new Vector3( 0*256, 0, 1*256 ), 1 ) + "\n"
             + prepareTextLine_from_vectPosXYZ( new Vector3( 1*256, 0, 1*256 ), 1 ) + "\n"
             + prepareTextLine_from_vectPosXYZ( new Vector3( 2*256, 0, 1*256 ), 1 ) + "\n"
             + prepareTextLine_from_vectPosXYZ( new Vector3( 3*256, 0, 1*256 ), 1 ) + "\n"
             + prepareTextLine_from_vectPosXYZ( new Vector3( 4*256, 0, 1*256 ), 1 ) + "\n"
             +
             + prepareTextLine_from_vectPosXYZ( new Vector3( 0*256, 0, 2*256 ), 1 ) + "\n"
             + prepareTextLine_from_vectPosXYZ( new Vector3( 1*256, 0, 2*256 ), 1 ) + "\n"
             + prepareTextLine_from_vectPosXYZ( new Vector3( 2*256, 0, 2*256 ), 1 ) + "\n"
             + prepareTextLine_from_vectPosXYZ( new Vector3( 3*256, 0, 2*256 ), 1 ) + "\n"
             + prepareTextLine_from_vectPosXYZ( new Vector3( 4*256, 0, 2*256 ), 1 ) + "\n"
             + );
             */

            /*
             * GUI.Label (textAreaCuriosityLocationInfo,
             *        "Loc0:" + prepareTextLine_from_vectLonxLaty_Tzoom (new Vector3 ( -180.0f, 85.051f, 0.0f), zoom ) + "\n"
             + "Loc1:" + prepareTextLine_from_vectLonxLaty_Tzoom (new Vector3 (  -90.0f, 85.051f, 0.0f), zoom ) + "\n"
             + "Loc2:" + prepareTextLine_from_vectLonxLaty_Tzoom (new Vector3 (    0.0f, 85.051f, 0.0f), zoom ) + "\n"
             + "Loc3:" + prepareTextLine_from_vectLonxLaty_Tzoom (new Vector3 (   90.0f, 85.051f, 0.0f), zoom ) + "\n"
             + "Loc4:" + prepareTextLine_from_vectLonxLaty_Tzoom (new Vector3 (  180.0f, 85.051f, 0.0f), zoom ) + "\n"
             + );
             */
            /*
             * GUI.Label (textAreaCuriosityLocationInfo,
             *      "Curiosity (rover) Bradbury Landing:" + prepareTextLine_from_vectLonxLaty_Tzoom (new Vector2 ( 137.4417f, -4.5895f ), zoom ) + "\n"
             + "Spirit (rover):" + prepareTextLine_from_vectLonxLaty_Tzoom (new Vector2 (  175.472636f, -14.5684f ), zoom ) + "\n"
             + "Opportunity_(rover):" + prepareTextLine_from_vectLonxLaty_Tzoom (new Vector2 ( 354.4734f, -1.9462f ), zoom ) + "\n"
             +      // + "Loc3:" + prepareTextLine_from_vectLonxLaty_Tzoom (new Vector2 (   90.0f, 85.051f ), zoom ) + "\n"
             +      // + "Loc4:" + prepareTextLine_from_vectLonxLaty_Tzoom (new Vector2 (  180.0f, 85.051f ), zoom ) + "\n"
             + );
             */

            /*
             * string str = "";
             * foreach (InterestingLocation il_element in InterestingLocation.InterestingLocationList)
             * {
             *      str += il_element.event_name + ": " + prepareTextLine_from_vectLonxLaty_Tzoom( il_element.vectLonxLaty, zoom ) + "\n";
             * }
             * GUI.Label (textAreaCuriosityLocationInfo, str );
             */
        }
    }
コード例 #21
0
 public void Init()
 {
     terrainLoader = GetComponent <TerrainLoader>();
 }
コード例 #22
0
ファイル: SimpleWDTTerrain.cs プロジェクト: kristoft/WCell
 public SimpleWDTTerrain(MapId mapId, TerrainLoader loader, bool loadOnDemand) : base(mapId, loader, loadOnDemand)
 {
     Init(mapId);
 }