public void RoadManagerTestsCheckIfNeighbourIsRoadInDictionaryCheckIfStraightRightLeftFitsR0() { var result = RoadManager.CheckIfStraightRoadFits((int)Direction.Left | (int)Direction.Right, null, roadSO); Assert.AreEqual(roadStraight, result.RoadPrefab); Assert.AreEqual(RotationValue.R0, result.RoadPrefabRotation); }
public void RoadManagerTestsCheckIfNeighbourIsRoadInDictionaryCheckIfStraightFits0() { var result = RoadManager.CheckIfStraightRoadFits(0, null, _roadSO); Assert.AreEqual(_roadStraight, result.RoadPrefab); Assert.AreEqual(RotationValue.R0, result.RoadPrefabRotation); }
public void RoadManagerTestsCheckIfNeighbourIsRoadInDictionaryCheckIfStraightFitsUpDownR90() { var result = RoadManager.CheckIfStraightRoadFits((int)Direction.Up | (int)Direction.Down, null, _roadSO); Assert.AreEqual(_roadStraight, result.RoadPrefab); Assert.AreEqual(RotationValue.R90, result.RoadPrefabRotation); }
public static RoadStructureHelper GetCorrectRoadPrefab(Vector3 gridPosition, StructureBaseSO structureDat, Dictionary<Vector3Int, GameObject> structuresToBeModified, GridStructure grid) { var neighborStatus = RoadManager.GetRoadNeighborStatus(gridPosition, grid, structuresToBeModified); RoadStructureHelper roadToReturn = null; roadToReturn = RoadManager.CheckIfStraightRoadFits(neighborStatus, roadToReturn, structureDat); if (roadToReturn != null) return roadToReturn; roadToReturn = RoadManager.CheckIfCornerRoadFits(neighborStatus, roadToReturn, structureDat); if (roadToReturn != null) return roadToReturn; roadToReturn = RoadManager.CheckIfThreewayRoadFits(neighborStatus, roadToReturn, structureDat); if (roadToReturn != null) return roadToReturn; roadToReturn = RoadManager.CheckIfFourwayRoadFits(neighborStatus, roadToReturn, structureDat); if (roadToReturn != null) return roadToReturn; return roadToReturn; }
public static RoadStructureHelper GetCorrectRoadPrefab(Vector3 gridPosition, StructureBaseSO structureData, Dictionary <Vector3Int, GameObject> structuresToBeModified, GridStructure grid) { var neighboursStatus = RoadManager.GetRoadNeighboursStatus(gridPosition, grid, structuresToBeModified); RoadStructureHelper roadToReturn = null; roadToReturn = RoadManager.CheckIfStraightRoadFits(neighboursStatus, roadToReturn, structureData); if (roadToReturn != null) { return(roadToReturn); } roadToReturn = RoadManager.CheckIfCornerFits(neighboursStatus, roadToReturn, structureData); if (roadToReturn != null) { return(roadToReturn); } roadToReturn = RoadManager.CheckIf3WayFits(neighboursStatus, roadToReturn, structureData); if (roadToReturn != null) { return(roadToReturn); } roadToReturn = RoadManager.CheckIf4WaysFits(neighboursStatus, roadToReturn, structureData); return(roadToReturn); }