예제 #1
0
        public void RoadManagerTestsCheckIfNeighbourIsRoadInDictionaryCheckIfCornerFitsR270()
        {
            var result = RoadManager.CheckIfCornerFits((int)Direction.Up | (int)Direction.Left, null, roadSO);

            Assert.AreEqual(roadCorner, result.RoadPrefab);
            Assert.AreEqual(RotationValue.R270, result.RoadPrefabRotation);
        }
예제 #2
0
    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);
    }