Ejemplo n.º 1
0
    public Structure buildStructure(Road connectedTo, Direction directionFromRoad, Structure.Type givenType, int width, int depth)
    {
//		Debug.LogError("building " + givenType.ToString() + " to the " + directionFromRoad + " of " + connectedTo.foundation.ToS() + " with width " + width + " and depth " + depth);
        Tile targetDriveway = connectedTo.foundation.getDirection(directionFromRoad);
//		Debug.LogError("target driveway: " + targetDriveway.ToS() + " - " + targetDriveway.Loc().ToString());

        LocationPair locals = BoundsForStructure(targetDriveway, directionFromRoad, width, depth);

        return(buildStructure(connectedTo, directionFromRoad, givenType, locals));
    }
Ejemplo n.º 2
0
    public Structure buildStructure(Road connectedTo, Direction directionFromRoad, Structure.Type givenType, LocationPair locals)
    {
        if (locals == null)
        {
            return(null);
        }

        Int2 localLowerLeft  = locals.lowerLeft;
        Int2 localUpperRight = locals.upperRight;

        int depth = locals.DistanceInDirection(directionFromRoad);

        //		Debug.LogError("local lower left: " + localLowerLeft.ToString());
        //		Debug.LogError("local upper right: " + localUpperRight.ToString());

        Int2 globalLowerLeft  = localLowerLeft;
        Int2 globalUpperRight = localUpperRight;

        switch (directionFromRoad)
        {
        case Direction.East:
            globalLowerLeft  = Directions.InDirectionForDistance(localUpperRight, Directions.oppositeOf(directionFromRoad), depth);
            globalUpperRight = Directions.InDirectionForDistance(localLowerLeft, directionFromRoad, depth);
            break;

        case Direction.South:
            globalLowerLeft  = localUpperRight;
            globalUpperRight = localLowerLeft;
            break;

        case Direction.West:
            globalUpperRight = Directions.InDirectionForDistance(localUpperRight, Directions.oppositeOf(directionFromRoad), depth);
            globalLowerLeft  = Directions.InDirectionForDistance(localLowerLeft, directionFromRoad, depth);
            break;
        }

        //		Debug.LogError("global lower left: " + globalLowerLeft.ToString());
        //		Debug.LogError("global upper right: " + globalUpperRight.ToString());

        Structure built = new Structure(connectedTo, directionFromRoad, givenType, globalLowerLeft, globalUpperRight);

        return(built);
    }
Ejemplo n.º 3
0
 public StructureInfo(Vector3Int position, Structure.Type type, int seed)
 {
     this.position = position;
     this.type     = type;
     this.seed     = seed;
 }