/// <summary> /// Restores the sector state from a memento. This also needs the list of /// available players in order to set up the Owner reference. /// </summary> /// <param name="memento">The memento to restore from.</param> /// <param name="players">The list of current players.</param> public void RestoreFromMemento(SerializableSector memento, Player[] players) { // restore the occupying unit if (memento.unit != null) { unit = Instantiate(players[memento.ownerId].unitPrefab).GetComponent <Unit>(); unit.RestoreFromMemento(memento.unit, players, this); } landmark = gameObject.GetComponentInChildren <Landmark>(); if (landmark != null) { landmark.RestoreFromMemento(memento.landmark); } if (memento.ownerId >= 0) { players[memento.ownerId].Capture(this); } pvc = memento.PVC; }