public void UnloadAsset() { //TODO: unload textures/shaders? Media.ObjectList.Remove(this); if (this.HasBones) { Agk.DeleteObjectWithChildren(this.ResourceNumber); } else { Agk.DeleteObject(this.ResourceNumber); } }
public static void UnloadAllObjectAssets() { foreach (var i in Media.ObjectList) { //TODO: unload/unlink textures/shaders? if (i.HasBones) { Agk.DeleteObjectWithChildren(i.ResourceNumber); } else { Agk.DeleteObject(i.ResourceNumber); } } Media.ObjectList.Clear(); }
public void ReplaceAsset(string rFilename, bool rCanInstance) { //TODO: unload textures/shaders? if (this.HasBones) { Agk.DeleteObjectWithChildren(this.ResourceNumber); } else { Agk.DeleteObject(this.ResourceNumber); } if (System.IO.File.Exists(rFilename)) { this.File = rFilename; var sourceObject = Media.ObjectList.FirstOrDefault(o => o.File == rFilename && o.InstanceType == 0); if (sourceObject != null) { if (Agk.IsObjectExists(sourceObject.ResourceNumber)) { if (rCanInstance) { this.ResourceNumber = Agk.InstanceObject(sourceObject.ResourceNumber); this.InstanceType = 2; } else { this.ResourceNumber = Agk.CloneObject(sourceObject.ResourceNumber); this.InstanceType = 1; } } else { if (this.HasBones) { Agk.LoadObjectWithChildren(sourceObject.ResourceNumber, rFilename); } else { Agk.LoadObject(sourceObject.ResourceNumber, rFilename); } sourceObject.Id = this.Id; } } else { if (this.HasBones) { this.ResourceNumber = Agk.LoadObjectWithChildren(rFilename); } else { this.ResourceNumber = Agk.LoadObject(rFilename); } this.InstanceType = 0; } } else { App.Log("Media", 4, "error", "ERROR: File not found: " + rFilename + " during Media_LoadObject."); App.StopRunning(true); } }