Exemple #1
0
            public static string Execute(params string[] args)
            {
                DaggerfallWorkshop.StreamingWorld  streamingWorld  = GameManager.Instance.StreamingWorld;//GameObject.FindObjectOfType<DaggerfallWorkshop.StreamingWorld>();
                DaggerfallWorkshop.DaggerfallUnity daggerfallUnity = DaggerfallUnity.Instance;
                DaggerfallSongPlayer songPlayer = GameObject.FindObjectOfType <DaggerfallSongPlayer>();

                DefaultCommands.showDebugStrings = !DefaultCommands.showDebugStrings;
                bool show = DefaultCommands.showDebugStrings;

                if (streamingWorld)
                {
                    streamingWorld.ShowDebugString = show;
                }
                if (daggerfallUnity)
                {
                    daggerfallUnity.WorldTime.ShowDebugString = show;
                }
                if (songPlayer)
                {
                    songPlayer.ShowDebugString = show;
                }
                if (FPSDisplay.fpsDisplay == null)
                {
                    GameManager.Instance.gameObject.AddComponent <FPSDisplay>();
                }
                FPSDisplay.fpsDisplay.ShowDebugString = show;
                return(string.Format("Debug string show: {0}", show));
            }
Exemple #2
0
            public static string Execute(params string[] args)
            {
                int x = 0; int y = 0;

                DaggerfallWorkshop.StreamingWorld streamingWorld = GameManager.Instance.StreamingWorld; //GameObject.FindObjectOfType<DaggerfallWorkshop.StreamingWorld>();
                PlayerEnterExit playerEE = GameManager.Instance.PlayerEnterExit;                        //GameObject.FindObjectOfType<PlayerEnterExit>();

                if (args == null || args.Length < 2)
                {
                    return(HelpCommand.Execute(TeleportToMapPixel.name));
                }

                else if (streamingWorld == null)
                {
                    return("Could not locate Streaming world object");
                }


                else if (playerEE == null || playerEE.IsPlayerInside)
                {
                    return("PlayerEnterExit could not be found or player inside");
                }

                else if (int.TryParse(args[0], out x) && int.TryParse(args[1], out y))
                {
                    if (x <= 0 || y <= 0)
                    {
                        return("Invalid Coordinates");
                    }
                    else if (x >= MapsFile.MaxMapPixelX || y >= MapsFile.MaxMapPixelY)
                    {
                        return("Invalid coordiantes");
                    }
                    else
                    {
                        streamingWorld.TeleportToCoordinates(x, y);
                    }
                    return(string.Format("Teleporting player to: {0} {1}", x, y));
                }
                return("Invalid coordiantes");
            }
        void Start()
        {
            dfUnity = DaggerfallUnity.Instance;

            useDeferredReflections = (GameManager.Instance.MainCamera.renderingPath == RenderingPath.DeferredShading);

            if (!streamingWorld)
                streamingWorld = GameObject.Find("StreamingWorld").GetComponent<StreamingWorld>();
            if (!streamingWorld)
            {
                DaggerfallUnity.LogMessage("InjectReflectiveMaterialProperty: Missing StreamingWorld reference.", true);
                if (Application.isEditor)
                    Debug.Break();
                else
                    Application.Quit();
            }

            if (GameObject.Find("IncreasedTerrainDistanceMod") != null)
            {
                if (DaggerfallUnity.Settings.Nystul_IncreasedTerrainDistance)
                {
                    extraTranslationY = GameObject.Find("IncreasedTerrainDistanceMod").GetComponent<ProjectIncreasedTerrainDistance.IncreasedTerrainDistance>().ExtraTranslationY;
                }
            }

            gameObjectReflectionPlaneGroundLevel = GameObject.Find("ReflectionPlaneBottom");
            gameObjectReflectionPlaneSeaLevel = GameObject.Find("ReflectionPlaneSeaLevel");
            gameObjectReflectionPlaneLowerLevel = gameObjectReflectionPlaneSeaLevel;

            // get inactive gameobject StreamingTarget (just GameObject.Find() would fail to find inactive gameobjects)
            GameObject[] gameObjects = Resources.FindObjectsOfTypeAll<GameObject>();
            foreach (GameObject currentGameObject in gameObjects)
            {
                string objectPathInHierarchy = GetGameObjectPath(currentGameObject);
                if (objectPathInHierarchy == "/Exterior/StreamingTarget")
                {
                    gameObjectStreamingTarget = currentGameObject;
                }
            }

            iniData = getIniParserConfigInjectionTextures();
        }
        void Start()
        {
            dfUnity = DaggerfallUnity.Instance;
            songPlayer = GetComponent<DaggerfallSongPlayer>();

            // Get local player GPS if not set
            if (LocalPlayerGPS == null)
                LocalPlayerGPS = GameManager.Instance.PlayerGPS;

            // Get streaming world if not set
            if (StreamingWorld == null)
                StreamingWorld = GameManager.Instance.StreamingWorld;

            // Get required player components
            if (LocalPlayerGPS)
            {
                playerEnterExit = LocalPlayerGPS.GetComponent<PlayerEnterExit>();
                playerWeather = LocalPlayerGPS.GetComponent<PlayerWeather>();
            }
        }
        void Start()
        {
            dfUnity = DaggerfallUnity.Instance;

            reflectionTexturesScript = GameObject.Find("ReflectionsMod").GetComponent<UpdateReflectionTextures>();

            if (!streamingWorld)
                streamingWorld = GameObject.Find("StreamingWorld").GetComponent<StreamingWorld>();
            if (!streamingWorld)
            {
                DaggerfallUnity.LogMessage("InjectReflectiveMaterialProperty: Missing StreamingWorld reference.", true);
                if (Application.isEditor)
                    Debug.Break();
                else
                    Application.Quit();
            }

            gameObjectReflectionPlaneGroundLevel = GameObject.Find("ReflectionPlaneBottom");
            gameObjectReflectionPlaneSeaLevel = GameObject.Find("ReflectionPlaneSeaLevel");
            gameObjectReflectionPlaneLowerLevel = gameObjectReflectionPlaneSeaLevel;

            // get inactive gameobject StreamingTarget (just GameObject.Find() would fail to find inactive gameobjects)
            GameObject[] gameObjects = Resources.FindObjectsOfTypeAll<GameObject>();
            foreach (GameObject currentGameObject in gameObjects)
            {
                string objectPathInHierarchy = GetGameObjectPath(currentGameObject);
                if (objectPathInHierarchy == "/Exterior/StreamingTarget")
                {
                    gameObjectStreamingTarget = currentGameObject;
                }
            }

            iniData = getIniParserConfigInjectionTextures();
        }
        void Awake()
        {
            if (!DaggerfallUnity.Settings.Nystul_IncreasedTerrainDistance)
                return;

            dfUnity = DaggerfallUnity.Instance;

            dfUnity.TerrainSampler = new ImprovedTerrainSampler();

            //ImprovedTerrainSampler improvedTerrainSampler = DaggerfallUnity.Instance.TerrainSampler as ImprovedTerrainSampler;
            //if (improvedTerrainSampler == null)
            //{
            //    DaggerfallUnity.LogMessage("IncreasedTerrainDistance: TerrainSampler instance is not of type ImprovedTerrainSampler (use ITerrainSampler terrainSampler = new ImprovedTerrainSampler() in DaggerfallUnity.cs)", true);
            //}

            if (!streamingWorld)
                streamingWorld = GameObject.Find("StreamingWorld").GetComponent<StreamingWorld>();
            if (!streamingWorld)
            {
                DaggerfallUnity.LogMessage("IncreasedTerrainDistance: Missing StreamingWorld reference.", true);
                if (Application.isEditor)
                    Debug.Break();
                else
                    Application.Quit();
            }

            if (!playerGPS)
                playerGPS = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerGPS>();
            if (!playerGPS)
            {
                DaggerfallUnity.LogMessage("IncreasedTerrainDistance: Missing PlayerGPS reference.", true);
                if (Application.isEditor)
                    Debug.Break();
                else
                    Application.Quit();
            }

            if (!weatherManager)
            {
                //weatherManager = GameObject.Find("WeatherManager").GetComponent<WeatherManager>();
                WeatherManager[] weatherManagers = Resources.FindObjectsOfTypeAll<WeatherManager>();
                foreach (WeatherManager currentWeatherManager in weatherManagers)
                {
                    GameObject go = currentWeatherManager.gameObject;
                    string objectPathInHierarchy = GetGameObjectPath(go);
                    if (objectPathInHierarchy == "/Exterior/WeatherManager")
                    {
                        weatherManager = currentWeatherManager;
                        break;
                    }
                }
            }
            if (!weatherManager)
            {
                DaggerfallUnity.LogMessage("IncreasedTerrainDistance: Missing WeatherManager reference.", true);
                if (Application.isEditor)
                    Debug.Break();
                else
                    Application.Quit();
            }

            SetupGameObjects(); // create cameras here in OnAwake() so MirrorReflection script of ReflectionsMod can find cameras in its Start() function
        }
Exemple #7
0
            public static string Execute(params string[] args)
            {
                int n = 0;

                DaggerfallWorkshop.StreamingWorld streamingWorld = GameManager.Instance.StreamingWorld; //GameObject.FindObjectOfType<DaggerfallWorkshop.StreamingWorld>();
                PlayerEnterExit playerEE = GameManager.Instance.PlayerEnterExit;                        //GameObject.FindObjectOfType<PlayerEnterExit>();

                if (args == null || args.Length < 1)
                {
                    return(HelpCommand.Execute(GotoLocation.name));
                }

                else if (streamingWorld == null)
                {
                    return("Could not locate Streaming world object");
                }

                else if (playerEE == null || playerEE.IsPlayerInside)
                {
                    return("PlayerEnterExit could not be found or player inside");
                }


                else if (int.TryParse(args[0], out n))
                {
                    if (n < 0 || n > 9)
                    {
                        return("Invalid location index");
                    }
                    else
                    {
                        switch (n)
                        {
                        case 0:
                            int xpos, ypos;
                            while (true)
                            {
                                xpos = UnityEngine.Random.Range(0, MapsFile.MaxMapPixelX - 1);
                                ypos = UnityEngine.Random.Range(0, MapsFile.MaxMapPixelY - 1);
                                DaggerfallWorkshop.Utility.ContentReader.MapSummary mapSummary;
                                if (DaggerfallWorkshop.DaggerfallUnity.Instance.ContentReader.HasLocation(xpos, ypos, out mapSummary))
                                {
                                    streamingWorld.TeleportToCoordinates(xpos + 1, ypos - 1);     // random location - locations always seem to be one pixel to the northern east - so compensate for this (since locations are never at the border - there should not occur a index out of bounds...)
                                    return(string.Format("Teleported player to location at: {0}, {1}", xpos, ypos));
                                }
                            }

                        case 1:
                            streamingWorld.TeleportToCoordinates(207, 213, StreamingWorld.RepositionMethods.RandomStartMarker);
                            return("Teleported player to Daggerfall/Daggerfall");

                        case 2:
                            streamingWorld.TeleportToCoordinates(859, 244, StreamingWorld.RepositionMethods.RandomStartMarker);
                            return("Teleported player to Wayrest/Wayrest");

                        case 3:
                            streamingWorld.TeleportToCoordinates(397, 343, StreamingWorld.RepositionMethods.RandomStartMarker);
                            return("Teleported player to Sentinel/Sentinel");

                        case 4:
                            streamingWorld.TeleportToCoordinates(892, 146, StreamingWorld.RepositionMethods.RandomStartMarker);
                            return("Teleported player to Orsinium Area/Orsinium");

                        case 5:
                            streamingWorld.TeleportToCoordinates(67, 119, StreamingWorld.RepositionMethods.RandomStartMarker);
                            return("Teleported player to Tulune/The Old Copperham Place");

                        case 6:
                            streamingWorld.TeleportToCoordinates(254, 408, StreamingWorld.RepositionMethods.RandomStartMarker);
                            return("Teleported player to Pothago/The Stronghold of Cirden");

                        case 7:
                            streamingWorld.TeleportToCoordinates(109, 158, StreamingWorld.RepositionMethods.RandomStartMarker);
                            return("Teleported player to Daggerfall/Privateer's Hold");

                        case 8:
                            streamingWorld.TeleportToCoordinates(860, 245, StreamingWorld.RepositionMethods.RandomStartMarker);
                            return("Teleported player to Wayrest/Merwark Hollow");

                        case 9:
                            streamingWorld.TeleportToCoordinates(718, 204, StreamingWorld.RepositionMethods.RandomStartMarker);
                            return("Teleported player to Isle of Balfiera/Direnni Tower");

                        default:
                            break;
                        }
                        return("Teleported successfully.");
                    }
                }
                return("Invalid location index");
            }