public CellSaveData GetSaveData() { CellSaveData save = new CellSaveData(); save.Position = new PositionIndex(this.position); CellNeighbourIndicies neighborIndicies = new CellNeighbourIndicies(); CellNeighbourIndicies linkIndicies = new CellNeighbourIndicies(); if (Neighbours.East != null) { neighborIndicies.East = new PositionIndex(Neighbours.East.position); } if (Neighbours.West != null) { neighborIndicies.West = new PositionIndex(Neighbours.West.position); } if (Neighbours.North != null) { neighborIndicies.North = new PositionIndex(Neighbours.North.position); } if (Neighbours.South != null) { neighborIndicies.South = new PositionIndex(Neighbours.South.position); } if (linkNeigbours.East != null) { linkIndicies.East = new PositionIndex(linkNeigbours.East.position); } if (linkNeigbours.West != null) { linkIndicies.West = new PositionIndex(linkNeigbours.West.position); } if (linkNeigbours.North != null) { linkIndicies.North = new PositionIndex(linkNeigbours.North.position); } if (linkNeigbours.South != null) { linkIndicies.South = new PositionIndex(linkNeigbours.South.position); } save.Neigbours = neighborIndicies; save.Links = linkIndicies; return(save); }
public Cell(CellSaveData cellSaveData) { position = cellSaveData.Position.ToVector2Int(); }