public static HUDObject LoadFromStorage(Storage.HUDObject storageHudObject, Storage.HUD storageHud) { // Build collisionboxes, hitboxes and events from storageCharacter // No worries with performance here, get a copy to everything HUDObject hudObj = new HUDObject(); hudObj.name = storageHudObject.name; hudObj.teamId = storageHudObject.teamId; hudObj.playerId = storageHudObject.playerId; hudObj.attackAndGrabDelegation = storageHudObject.attackAndGrabDelegation; // Populate events if (storageHudObject.events != null) { hudObj.events = new List <ConditionalEvent>(storageHudObject.events.Length); foreach (Storage.GenericEvent e in storageHudObject.events) { hudObj.events.Add(ConditionalEvent.LoadFromStorage(e, storageHud)); } } else { hudObj.events = new List <ConditionalEvent>(); } return(hudObj); }
public static CharacterAnimation LoadFromStorage(Storage.CharacterAnimation storageAnimation, Storage.Character storageCharacter) { // Build collisionboxes, hitboxes and events from storageCharacter // No worries with performance here, get a copy to everything CharacterAnimation anim = new CharacterAnimation(storageAnimation.name, storageAnimation.numFrames); // Populate collision boxes if (storageAnimation.collisionBoxes != null) { anim.collisionBoxes = new List <CollisionBox>(storageAnimation.collisionBoxes.Length); foreach (Storage.CollisionBox box in storageAnimation.collisionBoxes) { anim.collisionBoxes.Add(CollisionBox.LoadFromStorage(box, storageCharacter)); } } else { anim.collisionBoxes = new List <CollisionBox>(); } // Populate hit boxes if (storageAnimation.hitBoxes != null) { anim.hitBoxes = new List <HitBox>(storageAnimation.hitBoxes.Length); foreach (Storage.HitBox box in storageAnimation.hitBoxes) { anim.hitBoxes.Add(HitBox.LoadFromStorage(box, storageCharacter)); } } else { anim.hitBoxes = new List <HitBox>(); } // Populate events if (storageAnimation.events != null) { anim.events = new List <ConditionalEvent>(storageAnimation.events.Length); foreach (Storage.GenericEvent e in storageAnimation.events) { anim.events.Add(ConditionalEvent.LoadFromStorage(e, storageCharacter)); } } else { anim.events = new List <ConditionalEvent>(); } return(anim); }