//
// This file is part of the Tremble package by Tiny Goose.
// Copyright (c) 2024-2026 TinyGoose Ltd., All Rights Reserved.
//
using System;
using UnityEngine;
namespace TinyGoose.Tremble
{
public enum CheckerboardStyle
{
None,
Light,
Dark,
}
public enum BrushType
{
// Solid brush with a texture (default)
Solid,
// Liquid brush (trigger collision) with a texture
Liquid,
// An invisible brush which is a Unity trigger
Trigger,
// An invisible (but solid) brush
Invisible
}
///
/// Marks this MonoBehaviour as a component which can be added to arbitrary Brush entities from a map.
///
[AttributeUsage(AttributeTargets.Class)]
public class BrushEntityAttribute : EntityAttributeBase
{
///
/// A Tremble-compatible Brush entity.
///
/// The name in TrenchBroom. e.g. "cool_entity".
/// The category for TrenchBroom. e.g. "ent".
/// The brush type. e.g. Trigger, Solid, Liquid.
/// The colour of this brush's texture.
/// The type of checkerboard for this brush's texture.
/// The layer name to put this brush on.
public BrushEntityAttribute(
string trenchBroomName = null,
string category = null,
BrushType type = BrushType.Solid,
string colour = "",
CheckerboardStyle checkerStyle = CheckerboardStyle.None,
string layer = "")
: base(trenchBroomName, category)
{
m_BrushType = type;
m_Colour = colour.TryParseQ3Colour(out Color value) ? value : null;
m_CheckerStyle = checkerStyle;
m_LayerName = layer;
}
private readonly BrushType m_BrushType;
private readonly Color? m_Colour;
private readonly CheckerboardStyle m_CheckerStyle;
private readonly string m_LayerName;
public BrushType BrushType => m_BrushType;
public Color? Colour => m_Colour;
public CheckerboardStyle CheckerStyle => m_CheckerStyle;
public string LayerName => m_LayerName;
}
}