WorldBuilder.CreateWall C# (CSharp) Method

CreateWall() public method

Instantiates a wall between two cells.
public CreateWall ( Cell, cellA, Direction, inDirection, int prefabID ) : void
cellA Cell, /// Cell a. ///
inDirection Direction,
prefabID int
return void
    void CreateWall( Cell cellA, Direction inDirection, int prefabID )
    {
        Vector3 spawnPos = cellA.centrePosition;
        Quaternion spawnRot = Quaternion.identity;
        switch( inDirection )
        {
        case Direction.North:
            spawnPos += Vector3.forward * CellMaster.cellSize * 0.5f;
            break;
        case Direction.South:
            spawnPos += Vector3.back * CellMaster.cellSize * 0.5f;
            break;
        case Direction.East:
            spawnPos += Vector3.right * CellMaster.cellSize * 0.5f;
            spawnRot = Quaternion.AngleAxis ( 90, Vector3.up );
            break;
        case Direction.West:
            spawnPos += Vector3.left * CellMaster.cellSize * 0.5f;
            spawnRot = Quaternion.AngleAxis ( 90, Vector3.up );
            break;
        }

        Instantiate ( wallPrefabs[prefabID], spawnPos, spawnRot );
    }