public void LoadConnectables()
        {
            var savePathDir = Path.Combine(Main.GetSavePathDir(), "Connectables");

            if (Directory.Exists(savePathDir))
            {
                var files = new DirectoryInfo(savePathDir).GetFiles();

                foreach (var file in files)
                {
                    var id            = Path.GetFileNameWithoutExtension(file.Name);
                    var connectedToId = File.ReadAllText(file.FullName);

                    var main        = UniqueIdentifierHelper.GetByName(id);
                    var connectedTo = UniqueIdentifierHelper.GetByName(connectedToId);

                    if (main && connectedTo)
                    {
                        main.GetComponent <Connectable>().OnConnectEnd(connectedTo.GetComponent <Connectable>());
                    }
                    else
                    {
                        Console.WriteLine("Nullll!");
                    }
                }
            }
        }
Пример #2
0
        public static Optional <GameObject> GetObjectFrom(String guid)
        {
            GameObject gameObject = UniqueIdentifierHelper.GetByName(guid);

            return(Optional <GameObject> .OfNullable(gameObject));
        }