예제 #1
0
 public CustomTile(int _life, World.BlockType _type, int _amount)
 {
     life         = _life;
     type         = _type;
     amount       = _amount;
     isMineable   = false;
     isMined      = false;
     isDiscovered = false;
 }
예제 #2
0
    public void Move(Vector3 deltaMovement)
    {
        Vector3 newHorizontalPosition = transform.position + new Vector3(deltaMovement.x, 0, 0);
        Vector3 newVerticalPosition   = transform.position + new Vector3(0, deltaMovement.y, 0);

        World.BlockType verticalBlockType   = World.Instance.GetBlockType(newVerticalPosition);
        World.BlockType horizontalBlockType = World.Instance.GetBlockType(newHorizontalPosition);
        if (verticalBlockType != World.BlockType.VOID && verticalBlockType != World.BlockType.DAEGUNIUM)
        {
            deltaMovement.y = 0;
        }
        if (horizontalBlockType != World.BlockType.VOID && horizontalBlockType != World.BlockType.DAEGUNIUM)
        {
            deltaMovement.x = 0;
        }

        transform.Translate(deltaMovement, Space.World);
    }
예제 #3
0
    public override void GetTileData(Vector3Int position, ITilemap tilemap, ref TileData tileData)
    {
        World.BlockType blockType = BlockType(tilemap, position);
        if (!World.Instance.isTileDiscovered((Vector2Int)position))
        {
            blockType = World.BlockType.ROCK;
        }

        switch (blockType)
        {
        case World.BlockType.VOID:
            tileData.sprite = null;
            break;

        case World.BlockType.ROCK:
            tileData.sprite = blockSprites[1];
            break;

        case World.BlockType.IRON:
            tileData.sprite = blockSprites[2];
            break;

        case World.BlockType.COPPER:
            tileData.sprite = blockSprites[3];
            break;

        case World.BlockType.GOLD:
            tileData.sprite = blockSprites[4];
            break;

        case World.BlockType.DIAMOND:
            tileData.sprite = blockSprites[5];
            break;

        case World.BlockType.DAEGUNIUM:
            tileData.sprite = blockSprites[6];
            break;
        }
    }
예제 #4
0
 private bool HasRock(ITilemap tilemap, Vector3 position)
 {
     World.BlockType type = World.Instance.GetBlockType(position);
     return(type != World.BlockType.VOID && type != World.BlockType.DAEGUNIUM);
 }