Paint towers with some the colors of the wind
This commit is contained in:
parent
fec4433691
commit
04ead32846
15 changed files with 584 additions and 32 deletions
|
|
@ -43,6 +43,22 @@ namespace TD.Core
|
|||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Paint color applied to a built tower by the Paint tool. Orthogonal to the owner's
|
||||
/// player color: <see cref="None"/> means "unpainted" and the tower shows its owner
|
||||
/// color; any other value overrides the visual tint and (in a later iteration) drives
|
||||
/// projectile behavior (splash / poison-DoT / slow). Backed by byte for compact
|
||||
/// NetworkVariable replication.
|
||||
/// </summary>
|
||||
public enum PaintColor : byte
|
||||
{
|
||||
/// <summary>Unpainted — tower shows its owner color. Also the Reset brush.</summary>
|
||||
None = 0,
|
||||
Red = 1,
|
||||
Green = 2,
|
||||
Blue = 3,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Identifies a player slot in a match. Backed by byte to keep grid arrays compact.
|
||||
/// </summary>
|
||||
|
|
|
|||
50
Assets/_Project/Scripts/Core/PaintColors.cs
Normal file
50
Assets/_Project/Scripts/Core/PaintColors.cs
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace TD.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Canonical RGB values for the tower Paint tool. Saturated primaries so a painted
|
||||
/// tower reads clearly against any owner color. Mirrors the <see cref="PlayerColors"/>
|
||||
/// style (HexRGB constants + a switch lookup).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <see cref="PaintColor.None"/> has no color of its own — it means "unpainted", and
|
||||
/// callers fall back to the owner color (<see cref="PlayerColors.Get"/>) in that case.
|
||||
/// <see cref="Get"/> returns a neutral gray for <c>None</c> only so the Reset brush /
|
||||
/// swatch has something to render; tinting code should branch on <c>None</c> before
|
||||
/// calling this.
|
||||
/// </remarks>
|
||||
public static class PaintColors
|
||||
{
|
||||
private static readonly Color PaintRed = HexRGB(0xD8, 0x2A, 0x2A);
|
||||
private static readonly Color PaintGreen = HexRGB(0x2E, 0xC0, 0x3A);
|
||||
private static readonly Color PaintBlue = HexRGB(0x2E, 0x6A, 0xE0);
|
||||
|
||||
// Neutral gray used to represent the Reset / "None" brush in UI swatches and the
|
||||
// paint cursor. Not applied as a tower tint (None towers revert to owner color).
|
||||
private static readonly Color ResetGray = HexRGB(0xB0, 0xB0, 0xB8);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the color for a <see cref="PaintColor"/>. <see cref="PaintColor.None"/>
|
||||
/// returns a neutral gray (for the Reset swatch/cursor) — actual tower tinting
|
||||
/// should treat <c>None</c> as "use owner color" and not call this for that case.
|
||||
/// </summary>
|
||||
public static Color Get(PaintColor color)
|
||||
{
|
||||
switch (color)
|
||||
{
|
||||
case PaintColor.Red: return PaintRed;
|
||||
case PaintColor.Green: return PaintGreen;
|
||||
case PaintColor.Blue: return PaintBlue;
|
||||
case PaintColor.None:
|
||||
default:
|
||||
return ResetGray;
|
||||
}
|
||||
}
|
||||
|
||||
private static Color HexRGB(byte r, byte g, byte b)
|
||||
{
|
||||
return new Color(r / 255f, g / 255f, b / 255f, 1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/_Project/Scripts/Core/PaintColors.cs.meta
Normal file
2
Assets/_Project/Scripts/Core/PaintColors.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 75443abdf5c5f43ec9547275fb20f25b
|
||||
Loading…
Add table
Add a link
Reference in a new issue