public void LoadComponent(SavedComponent sc) { template = TemplateController.Instance.templates[sc.template]; state = sc.state; beyondGroup = sc.group; side = sc.side; groupPosition = sc.groupPosition; cells = sc.cells; }
public static SavedGame CreateSavedGame() { SavedGame save = new SavedGame(); save.place = PlaceController.Instance.place; FirstPersonController.Instance.Save(ref save); FirstPersonMouseLook.Instance.Save(ref save); // Place has a list of BeyondGroup, but they don't save their components (can't serialize monobehaviour) // Do it by hand save.components = new List <SavedComponent>(); foreach (BeyondGroup bg in save.place.beyondGroups) { foreach (BeyondComponent bc in bg.componentList) { //TODO : but wait, how can a group have a null BC ? there's something rotten if (bc != null) { SavedComponent sc = new SavedComponent(bc); save.components.Add(sc); } } } return(save); }