public Client() { if (ActiveInstance != null) { return; // Only instantiate once } Decors = new DecorController(this); Game = new GameController(this); Player = new PlayerController(this); World = new WorldController(this); Sessions = new SessionManager(this); ActiveInstance = this; }
public void Create3DDecoreForHostParty(DecorData decor, Vector3 Pos, int dir, GameObject Parent) { if (decor == null) { return; } var asset = Resources.Load <Decor3DView> ("Decors/" + decor.Name.Trim('"')); if (asset == null) { for (int i = 0; i < DecorController.Instance.DownloadedDecors.Count; i++) { if (DecorController.Instance.DownloadedDecors [i].GetComponent <Decor3DView> ().name == decor.Name.Trim('"') || DecorController.Instance.DownloadedDecors [i].GetComponent <Decor3DView> ().name == DecorController.FirstCharToUpper(decor.Name.Trim('"'))) { asset = DecorController.Instance.DownloadedDecors [i].GetComponent <Decor3DView> (); } } } var _Layer = LayerMask.NameToLayer("Default"); GameObject Go = (GameObject)Instantiate(asset.gameObject, Pos, Quaternion.identity); Destroy(Go.GetComponent <DragSnap> ()); Go.transform.parent = Parent.transform; Go.transform.localPosition = Pos; // var drs = Go.AddComponent<DragSnap> (); // drs.grid = Parent.transform.GetChild (5).gameObject; Go.SetLayerRecursively(_Layer); Go.SetMaterialRecursively(); Go.GetComponent <Decor3DView> ().direction = dir; // To be Confirmed taht this fires after Start of Decor3D Go.GetComponent <Decor3DView> ().CreateDecore(decor); Go.GetComponent <Decor3DView> ().Start(); Go.transform.FindChild("SelectionParent").gameObject.SetActive(false); Destroy(Go.GetComponent <Decor3DView> ()); }