예제 #1
0
        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);
        }
예제 #4
0
    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;
    }
예제 #5
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);
    }