示例#1
0
 public void setProperties(DungeonAssetModule dungeonAsset, Utils.Orientation orientation)
 {
     this.orientation  = orientation;
     this.dungeonAsset = dungeonAsset;
     if (orientation == Utils.Orientation.horizontal)
     {
         spriteRenderer.sprite = dungeonAsset.spriteDoorFrontOpen;
         boxCollider.size      = new Vector2(2, 0.2f);
     }
     else
     {
         spriteRenderer.sprite = dungeonAsset.spriteDoorSideOpen;
         boxCollider.size      = new Vector2(0.2f, 2);
     }
 }
示例#2
0
    public static bool drawRoom(DungeonAssetModule dungeonAsset, Vector2Int origin, RoomProperty property, Utils.GlobalDirection direction)
    {
        //TODO add logic for room rotation
        DungeonDrawer.dungeonAsset = dungeonAsset;
        CellState[,] cells         = generateCells(property);
        //Ground and Collider draw
        try {
            for (int x = 0; x < property.basicDim.x; x++)
            {
                for (int y = 0; y < property.basicDim.y; y++)
                {
                    switch (cells[x, y])
                    {
                    case CellState.emptyCell:
                        placeTileCollider(new Vector3Int(origin.x + x, origin.y + y, 0),
                                          dungeonAsset.dungeonTiles.groundBase);
                        break;

                    case CellState.groundCell:
                        placeTileGround(new Vector3Int(origin.x + x, origin.y + y, 0),
                                        dungeonAsset.dungeonTiles.groundBase);
                        break;
                    }
                }
            }
            //Wall draw
            for (int x = 0; x < property.basicDim.x; x++)
            {
                for (int y = 0; y < property.basicDim.y; y++)
                {
                    // switch (cells[x, y])
                    // {

                    // }
                }
            }
        } catch (NullReferenceException ex) {
        }
        return(true);
    }
示例#3
0
 private void Awake()
 {
     dungeonAsset = GameObject.FindObjectOfType <DungeonAssetModule>();
 }