Пример #1
0
        public static SceneLoaderState GetCurrentState()
        {
            var zonePath = ZonePreference.Value;
            var spawn    = SpawnPreference.Value;
            var zoneType = ZoneTypePreference.Value;

            var state = new SceneLoaderState
            {
                Scenes     = SceneHelper.CaptureState(),
                StartSpawn = spawn
            };

            if (zoneType == LoadActiveZone)
            {
                var zone = FindZone();
                if (zone == null)
                {
                    var manager = FindWorldManager();

                    if (manager != null && manager.World != null)
                    {
                        zone = manager.World.Zones.Count > 0 ? manager.World.Zones[0] : null;
                    }
                }

                if (zone != null)
                {
                    state.SetZone(zone);
                }
            }
            else if (zoneType == LoadSpecificZone)
            {
                var zones = AssetHelper.ListAssets <Zone>();
                var zone  = GetZone(zones, zonePath);

                if (zone != null)
                {
                    state.SetZone(zone);
                }
            }
            else
            {
                state.LoadWorld = zoneType == LoadSavedZone;
            }

            return(state);
        }