public static WorldBuilderMain Instance() { if (instance == null) { instance = new WorldBuilderMain(); manager = SL.Get <GameManager>(); control = SL.Get <IVRControl>(); SL.Add <WorldBuilderMain>(instance); } return(instance); }
/// <summary> /// The master sorting algorithm for any collection sprites. /// </summary> public void Sort() { SL.Clear(); foreach (var layerMapItem in LayerMap) { SL.Add(layerMapItem.Value); } foreach (var sprite in DynamicSprites) { SL.Add(sprite); } OrderedLayerMap = SL.OrderBy(x => (x.Coords.X - x.Coords.Y)).ThenBy(x => x.Altitude).ThenBy(x => x.DrawPriority); }
void Start() { KeyboardMode.Hook(); int i = Application.dataPath.LastIndexOf("/"); Globals.WORLDPATH = Application.dataPath.Substring(0, i) + "/Worlds/"; Directory.CreateDirectory(Globals.WORLDPATH); Globals.BACKUPS = Application.dataPath.Substring(0, i) + "/BackupFiles/"; Directory.CreateDirectory(Globals.BACKUPS); Globals.BUNDLEPATH = Application.dataPath.Substring(0, i) + "/ArtPacks/"; Directory.CreateDirectory(Globals.BUNDLEPATH); Globals.TEMPFOLDER = Application.dataPath.Substring(0, i) + "/DWTemp/"; Directory.CreateDirectory(Globals.TEMPFOLDER); Globals.TODPATH = Application.dataPath.Substring(0, i) + "/tod2.tbl"; Globals.LEGACYPATH = Application.dataPath.Substring(0, i) + "/all.tbl"; Globals.FAVPATH = Application.dataPath.Substring(0, i) + "/dw.fav"; favorites = TODV2.LoadGeneric <List <int> >(Globals.FAVPATH); if (favorites == default(List <int>)) { favorites = new List <int>(); } if (Application.isEditor) { AssetBundleCreateRequest a = AssetBundleManager.Polygon_Adventure; } else { AssetBundleManager.Prewarm(); } SL.Add <GameManager>(this); SL.Add <Keyboard>(keyboard); hmd = rig.GetComponent <IVRHmd>(); hmd.Init(); SL.Add <IVRHmd>(hmd); control = rig.GetComponent <IVRControl>(); control.Init(this); SL.Add <IVRControl>(control); poserWidget.SetActive(false); if (control.GetControlStyle() == ControlerStyle.ViveWand) { lb1 = "Down"; lb2 = "Up"; rb1 = "Down"; rb2 = "Up"; } else if (control.GetControlStyle() == ControlerStyle.RiftTouch) { lb1 = "X"; lb2 = "Y"; rb1 = "A"; rb2 = "B"; } activeFM.Init(this); SL.Add <FileManagerV2>(activeFM); SetPrefs(); DeactivateStarter(); mode = WorldBuilderMain.Instance(); if (startPoint.position == Vector3.zero) { CalibrationMode.Instance().SetupMode(); } else { TitleScreenMode.Instance().SetupMode(); } }