/// <summary> /// Creates a new instance of Content. /// </summary> /// <param name="basePath">Path to client directory.</param> /// <param name="device">A GraphicsDevice instance.</param> private Content(string basePath, GraphicsDevice device) { this.BasePath = basePath; this.Device = device; UIGraphics = new UIGraphicsProvider(this, Device); AvatarMeshes = new AvatarMeshProvider(this, Device); AvatarBindings = new AvatarBindingProvider(this); AvatarTextures = new AvatarTextureProvider(this, Device); AvatarSkeletons = new AvatarSkeletonProvider(this); AvatarAppearances = new AvatarAppearanceProvider(this); AvatarOutfits = new AvatarOutfitProvider(this); AvatarAnimations = new AvatarAnimationProvider(this); AvatarPurchasables = new AvatarPurchasables(this); AvatarHandgroups = new HandgroupProvider(this, Device); WorldObjects = new WorldObjectProvider(this); WorldFloors = new WorldFloorProvider(this); WorldWalls = new WorldWallProvider(this); WorldObjectGlobals = new WorldGlobalProvider(this); Audio = new Audio(this); Init(); }
private VisualEffect GetEffectResource(string name) { if (!_ResourcesCache.ContainsKey(name)) { _ResourcesCache.Add(name, WorldObjectProvider.GetWorldObject <GameObject>(name).GetComponent <VisualEffect>()); } return(_ResourcesCache[name]); }
public void Spawn() { for (int i = 0; i < this.transform.childCount; i++) { var obj = Instantiate(WorldObjectProvider.GetWorldObject <GameObject>("Pickup"), this.transform.GetChild(i), false); obj.transform.localPosition = Vector3.zero; obj.transform.localRotation = Quaternion.identity; } }
private void AddFollower(PickupItem item) { if (FollowersCount < MaxFollowers) { var follower = Instantiate(WorldObjectProvider.GetWorldObject <GameObject>("Follower")).GetComponent <PlayerFollower>(); follower.Index = FollowersCount; _Followers.Add(follower); FollowersCount++; } }
public void Refresh() { var source = WorldObjectProvider.GetWorldObject <GameObject>(this.CleanName); if (source != null) { var obj = Instantiate(source, this.transform, false); obj.name = this.CleanName + "_" + WorldObjectProvider.CurrentWorld; obj.hideFlags = HideFlags.DontSave; _CurrentGameObject = obj; } else { _CurrentGameObject = null; } if (this.transform.childCount > 0) { #if UNITY_EDITOR if (Application.isPlaying) { for (int i = this.transform.childCount - 1; i >= 0; i--) { if (_CurrentGameObject != this.transform.GetChild(i).gameObject) { Destroy(this.transform.GetChild(i).gameObject); } } } else { UnityEditor.EditorApplication.delayCall += () => { if (this != null) { for (int i = this.transform.childCount - 1; i >= 0; i--) { if (_CurrentGameObject != this.transform.GetChild(i).gameObject) { DestroyImmediate(this.transform.GetChild(i).gameObject); } } } }; } #else for (int i = this.transform.childCount - 1; i >= 0; i--) { if (_CurrentGameObject != this.transform.GetChild(i).gameObject) { Destroy(this.transform.GetChild(i).gameObject); } } #endif } }
/// <summary> /// Creates a new instance of Content. /// </summary> /// <param name="basePath">Path to client directory.</param> /// <param name="device">A GraphicsDevice instance.</param> private Content(string basePath, GraphicsDevice device) { this.BasePath = basePath; this.Device = device; Changes = new ChangeManager(); UIGraphics = new UIGraphicsProvider(this); AvatarMeshes = new AvatarMeshProvider(this, Device); AvatarBindings = new AvatarBindingProvider(this); AvatarTextures = new AvatarTextureProvider(this, Device); AvatarSkeletons = new AvatarSkeletonProvider(this); AvatarAppearances = new AvatarAppearanceProvider(this); AvatarOutfits = new AvatarOutfitProvider(this); AvatarAnimations = new AvatarAnimationProvider(this); AvatarPurchasables = new AvatarPurchasables(this); AvatarHandgroups = new HandgroupProvider(this, Device); AvatarCollections = new AvatarCollectionsProvider(this); AvatarThumbnails = new AvatarThumbnailProvider(this, Device); WorldObjects = new WorldObjectProvider(this); WorldFloors = new WorldFloorProvider(this); WorldWalls = new WorldWallProvider(this); WorldObjectGlobals = new WorldGlobalProvider(this); WorldCatalog = new WorldObjectCatalog(); Audio = new Audio(this); GlobalTuning = new Tuning(Path.Combine(basePath, "tuning.dat")); Init(); }
public void Refresh() { ControlledRenderer.sharedMaterial = WorldObjectProvider.GetWorldObject <Material>(MaterialName); }