|
|
@@ -8,9 +8,12 @@ namespace TowerDevil
|
|
|
public sealed partial class TowerGame
|
|
|
{
|
|
|
RectTransform tiles, monsters, fx, shieldPips, guide, actionArea;
|
|
|
- RectTransform hud, boardStage, battleFooter, gateWindow, fieldClip, laneShade;
|
|
|
- RawImage gateArt;
|
|
|
+ RectTransform hud, boardStage, battleFooter, fieldClip;
|
|
|
+ CourtyardBackdrop courtyard;
|
|
|
+ PieceShadows pieceShadows;
|
|
|
+ readonly Dictionary<string, Sprite> courtSprites = new Dictionary<string, Sprite>();
|
|
|
GateFractures gateFractures;
|
|
|
+ Vector2 fractureOrigin;
|
|
|
BattleEffects battleEffects;
|
|
|
IronPanel turnDot, turnStrip;
|
|
|
readonly Dictionary<Piece, RawImage> pieces = new Dictionary<Piece, RawImage>();
|
|
|
@@ -89,50 +92,27 @@ namespace TowerDevil
|
|
|
nextMotionSeed = 0;
|
|
|
lastPlates = -1;
|
|
|
guide = null;
|
|
|
- boardStage = Box(page, "Battlefield", 0, 0, BoardLayout.Width, BoardLayout.Height);
|
|
|
- gateWindow = Box(boardStage, "Gate overlook", 0, 0, 750, 200);
|
|
|
- gateWindow.gameObject.AddComponent<RectMask2D>();
|
|
|
- gateArt = Image(gateWindow, "Sealed prison gate", "fortress", 55, 0, 640, 291);
|
|
|
- var gateRect = gateArt.rectTransform;
|
|
|
- gateRect.anchorMin = gateRect.anchorMax = gateRect.pivot = new Vector2(.5f, 0);
|
|
|
- gateRect.anchoredPosition = Vector2.zero;
|
|
|
- gateFractures = Box(gateRect, "Gate fractures", 0, 0, 0, 0).gameObject.AddComponent<GateFractures>();
|
|
|
- Stretch(gateFractures.rectTransform);
|
|
|
+ if (courtSprites.Count == 0)
|
|
|
+ foreach (var sprite in Resources.LoadAll<Sprite>("DevilArt/Courtyard"))
|
|
|
+ courtSprites.Add(sprite.name, sprite);
|
|
|
+ courtyard = Box(page, "Basalt courtyard", 0, 0, 1000, 1334).gameObject.AddComponent<CourtyardBackdrop>();
|
|
|
+ courtyard.SetPainting(Art("Courtyard/backdrop"));
|
|
|
+ gateFractures = Box(courtyard.transform, "Gate fractures", 0, 0, 0, 0).gameObject.AddComponent<GateFractures>();
|
|
|
gateFractures.raycastTarget = false;
|
|
|
- shieldPips = Box(boardStage, "Seal stones", 230, -88, 290, 38);
|
|
|
- turnStrip = Round(boardStage, "Turn strip", 27, -48, 696, 38, "24171B", "69404B", 19, "130C0F");
|
|
|
+ boardStage = Box(page, "Battlefield", 0, 0, BoardLayout.Width, BoardLayout.Height);
|
|
|
+ shieldPips = Box(boardStage, "Seal stones", 230, -92, 290, 35);
|
|
|
+ turnStrip = Round(boardStage, "Turn strip", 33, -47, 684, 33, "261D20", "75605A", 16, "171114");
|
|
|
assaultTint = false;
|
|
|
- turnDot = Round(turnStrip.transform, "Phase light", 18, 12, 14, 14, "A4F09D", "366439", 7, "5FC56F");
|
|
|
- turnLabel = Label(turnStrip.transform, "YOUR TURN", 45, 0, 228, 38, 17, Ink);
|
|
|
- waitLabel = Label(turnStrip.transform, "", 260, 0, 418, 38, 16, Hex("FFDA89"), TextAnchor.MiddleRight);
|
|
|
- for (int r = 0; r < Run.Size; r++)
|
|
|
- {
|
|
|
- float size = BoardLayout.Size(r), y = BoardLayout.Top(r);
|
|
|
- float x = (BoardLayout.Width - Run.Size * size) * .5f;
|
|
|
- Round(boardStage, "Rank " + r, x - 8, y - 6, size * Run.Size + 16, size + 14,
|
|
|
- "291920", "38252B", 13, "140C10");
|
|
|
- for (int c = 0; c < Run.Size; c++)
|
|
|
- Round(boardStage, "Cell " + r + "," + c, x + c * size + 1.5f, y, size - 3, size - 3,
|
|
|
- "513241", "82605C", 13, "271520");
|
|
|
- }
|
|
|
+ turnDot = Round(turnStrip.transform, "Phase light", 20, 11, 12, 12, "A4F09D", "366439", 6, "5FC56F");
|
|
|
+ turnLabel = Label(turnStrip.transform, "YOUR TURN", 46, 0, 223, 33, 17, Ink);
|
|
|
+ waitLabel = Label(turnStrip.transform, "", 247, 0, 418, 33, 16, Hex("FFDA89"), TextAnchor.MiddleRight);
|
|
|
var pieceWindow = Box(boardStage, "Piece viewport", 0, -10, BoardLayout.Width, BoardLayout.Height + 27);
|
|
|
pieceWindow.gameObject.AddComponent<RectMask2D>();
|
|
|
+ pieceShadows = Box(pieceWindow, "Contact shadows", 0, 10, BoardLayout.Width, BoardLayout.Height)
|
|
|
+ .gameObject.AddComponent<PieceShadows>();
|
|
|
+ pieceShadows.raycastTarget = false;
|
|
|
+ pieceShadows.Bind(pieces);
|
|
|
tiles = Box(pieceWindow, "Pieces", 0, 10, BoardLayout.Width, BoardLayout.Height);
|
|
|
- laneShade = Panel(boardStage, "Approach shadow", 0, BoardLayout.Height + 8, 750, 130, "11090D",
|
|
|
- "120A0D", 0).rectTransform;
|
|
|
- var shade = laneShade.GetComponent<IronPanel>();
|
|
|
- shade.stroke = 0;
|
|
|
- shade.top = new Color(.04f, .02f, .03f, .14f);
|
|
|
- shade.bottom = new Color(.06f, .025f, .04f, .84f);
|
|
|
- for (int side = 0; side < 2; side++)
|
|
|
- {
|
|
|
- var rock = Image(laneShade, "Runway rubble", "rubble", side == 0 ? -14 : 650, 0, 114, 112);
|
|
|
- rock.rectTransform.anchorMin = rock.rectTransform.anchorMax = new Vector2(0, 0);
|
|
|
- rock.rectTransform.anchoredPosition += Vector2.up * 112;
|
|
|
- rock.color = new Color(.47f, .40f, .42f, .78f);
|
|
|
- if (side == 1)
|
|
|
- rock.uvRect = new Rect(1, 0, -1, 1);
|
|
|
- }
|
|
|
fieldClip = Box(boardStage, "Visible battlefield", 0, -15, 750, 850);
|
|
|
fieldClip.gameObject.AddComponent<RectMask2D>();
|
|
|
monsters = Box(fieldClip, "Horde", 0, 15, 750, 1334);
|
|
|
@@ -143,14 +123,14 @@ namespace TowerDevil
|
|
|
.gameObject.AddComponent<BoardInput>();
|
|
|
input.Game = this;
|
|
|
BuildBattleHud();
|
|
|
- battleFooter = Box(page, "Battle footer", 0, 1184, 750, 150);
|
|
|
+ battleFooter = Box(page, "Battle footer", 0, 1221, 750, 113);
|
|
|
waveLabel = Label(battleFooter, "", 26, 0, 125, 35, 17, Ink);
|
|
|
Round(battleFooter, "Wave track", 145, 13, 454, 10, "3A292C", "49353A", 5, "2A1C20");
|
|
|
waveFill = Round(battleFooter, "Wave progress", 145, 13, 1, 10, "FFD473", "CD8D34", 5, "E59B38").rectTransform;
|
|
|
leftLabel = Label(battleFooter, "", 606, 0, 116, 35, 17, Muted, TextAnchor.MiddleRight);
|
|
|
- actionArea = Box(battleFooter, "Actions", 0, 57, 750, 84);
|
|
|
- SideAction("SHOP", "shop", 24, Merchant);
|
|
|
- SideAction("MENU", "menu", 558, PauseSheet);
|
|
|
+ actionArea = Box(battleFooter, "Actions", 0, 41, 750, 64);
|
|
|
+ SideAction("SHOP", "shop", 20, Merchant);
|
|
|
+ SideAction("MENU", "menu", 544, PauseSheet);
|
|
|
Fit();
|
|
|
lastDay = run.Day;
|
|
|
lastPhase = run.Phase;
|
|
|
@@ -163,30 +143,23 @@ namespace TowerDevil
|
|
|
void FitBattle(float safeHeight)
|
|
|
{
|
|
|
float extra = Mathf.Max(0, safeHeight - 1334);
|
|
|
- float boardY = 426 - extra * .2f;
|
|
|
+ float boardY = 460 - extra * .19f;
|
|
|
hud.anchoredPosition = new Vector2(0, extra * .5f);
|
|
|
boardStage.anchoredPosition = new Vector2(0, -boardY);
|
|
|
- battleFooter.anchoredPosition = new Vector2(0, -1184 - extra * .5f);
|
|
|
- float gateTop = 108 - extra * .5f - boardY;
|
|
|
- gateWindow.anchoredPosition = new Vector2(0, -gateTop);
|
|
|
- gateWindow.sizeDelta = new Vector2(750, -96 - gateTop);
|
|
|
- float available = boardY + extra * .5f - 96 - 158;
|
|
|
- float width = Mathf.Clamp((available + 20) * 2.7f, 495, 668);
|
|
|
- gateArt.rectTransform.sizeDelta =
|
|
|
- new Vector2(width, width * gateArt.texture.height / gateArt.texture.width);
|
|
|
+ battleFooter.anchoredPosition = new Vector2(0, -1221 - extra * .5f);
|
|
|
float laneEnd = -battleFooter.anchoredPosition.y - boardY;
|
|
|
fieldClip.sizeDelta = new Vector2(750, laneEnd + 15);
|
|
|
- laneShade.sizeDelta = new Vector2(750, laneEnd - BoardLayout.Height - 8);
|
|
|
- }
|
|
|
- void BattleShade(float low, float high, float lowerAlpha, float upperAlpha)
|
|
|
- {
|
|
|
- var band = Panel(battleVeil, "Shadow", 0, 0, 0, 0, "12090C", "12090C", 0);
|
|
|
- band.stroke = 0;
|
|
|
- band.bottom = new Color(.046f, .023f, .035f, lowerAlpha);
|
|
|
- band.top = new Color(.046f, .023f, .035f, upperAlpha);
|
|
|
- band.rectTransform.anchorMin = new Vector2(0, low);
|
|
|
- band.rectTransform.anchorMax = new Vector2(1, high);
|
|
|
- band.rectTransform.offsetMin = band.rectTransform.offsetMax = Vector2.zero;
|
|
|
+
|
|
|
+ Vector2 topLeft = page.InverseTransformPoint(screen.TransformPoint(new Vector2(screen.rect.xMin, screen.rect.yMax)));
|
|
|
+ Vector2 bottomRight = page.InverseTransformPoint(screen.TransformPoint(new Vector2(screen.rect.xMax, screen.rect.yMin)));
|
|
|
+ float visibleWidth = 2 * Mathf.Max(375 - topLeft.x, bottomRight.x - 375) + 2;
|
|
|
+ float width = Mathf.Max(1000, visibleWidth);
|
|
|
+ var painting = courtyard.rectTransform;
|
|
|
+ painting.anchoredPosition = new Vector2(375 - width * .5f, topLeft.y);
|
|
|
+ painting.sizeDelta = new Vector2(width, topLeft.y - bottomRight.y);
|
|
|
+ courtyard.Fit(topLeft.y + 138 - extra * .5f, topLeft.y + boardY - 66, visibleWidth);
|
|
|
+ courtyard.RegisterFractures(gateFractures.rectTransform);
|
|
|
+ fractureOrigin = gateFractures.rectTransform.anchoredPosition;
|
|
|
}
|
|
|
static IronPanel Round(Transform parent, string name, float x, float y, float w, float h, string face,
|
|
|
string rim, float radius, string lower = null)
|
|
|
@@ -198,31 +171,31 @@ namespace TowerDevil
|
|
|
}
|
|
|
void BuildBattleHud()
|
|
|
{
|
|
|
- hud = Box(page, "Warden HUD", 0, 0, 750, 158);
|
|
|
- Round(hud, "Portrait setting", 22, 13, 53, 53, "39251C", "F4B943", 14, "170F0D");
|
|
|
- Image(hud, "Warden portrait", "av_" + profile.avatar, 24, 15, 49, 49);
|
|
|
- var name = Label(hud, profile.name, 88, 13, 325, 53, 22, Ink);
|
|
|
+ hud = Box(page, "Warden HUD", 0, 0, 750, 118);
|
|
|
+ Round(hud, "Portrait setting", 15, 1, 44, 42, "39251C", "F4B943", 14, "170F0D");
|
|
|
+ Image(hud, "Warden portrait", "av_" + profile.avatar, 17, 2, 39, 39);
|
|
|
+ var name = Label(hud, profile.name, 71, 0, 325, 43, 22, Ink);
|
|
|
name.resizeTextForBestFit = true;
|
|
|
name.resizeTextMinSize = 15;
|
|
|
name.resizeTextMaxSize = 22;
|
|
|
- coinLabel = WalletPill("Gold", "ui_coin", 435, 108, "70404B", "FFCE65");
|
|
|
- shardLabel = WalletPill("Shards", "ui_gem", 554, 89, "34627C", "79D6FF");
|
|
|
- var pause = Round(hud, "Pause bezel", 664, 18, 49, 45, "22171C", "804452", 14, "120D10");
|
|
|
+ coinLabel = WalletPill("Gold", "ui_coin", 450, 94, "70404B", "FFCE65");
|
|
|
+ shardLabel = WalletPill("Shards", "ui_gem", 554, 83, "34627C", "79D6FF");
|
|
|
+ var pause = Round(hud, "Pause bezel", 693, 1, 46, 41, "22171C", "804452", 14, "120D10");
|
|
|
for (int i = 0; i < 2; i++)
|
|
|
- Solid(pause.transform, "Pause bar", 18 + i * 9, 15, 5, 15, Ink);
|
|
|
- Hotspot(hud, "Pause battle", 652, 2, 78, 70, PauseSheet);
|
|
|
- movesLabel = StatCard("MOVES", 22, "FF7964", "B82E23", "F8AA91", "A33D2C", Color.white);
|
|
|
- sealLabel = StatCard("SEAL", 261, "FFDA5E", "C48812", "FFE49B", "BE8D29", Hex("442C0C"));
|
|
|
- nightLabel = StatCard("NIGHT", 500, "67C8FC", "1B67AC", "96D5FE", "357CAA", Color.white);
|
|
|
- Hotspot(hud, "Seal details", 261, 78, 228, 78, SealSheet);
|
|
|
+ Solid(pause.transform, "Pause bar", 17 + i * 9, 12, 5, 15, Ink);
|
|
|
+ Hotspot(hud, "Pause battle", 674, 0, 74, 49, PauseSheet);
|
|
|
+ movesLabel = StatCard("MOVES", 15, "FF7964", "B82E23", "F8AA91", "A33D2C", Color.white);
|
|
|
+ sealLabel = StatCard("SEAL", 255, "FFDA5E", "C48812", "FFE49B", "BE8D29", Hex("442C0C"));
|
|
|
+ nightLabel = StatCard("NIGHT", 497, "67C8FC", "1B67AC", "96D5FE", "357CAA", Color.white);
|
|
|
+ Hotspot(hud, "Seal details", 255, 49, 230, 69, SealSheet);
|
|
|
}
|
|
|
Text WalletPill(string name, string icon, float x, float w, string border, string accent)
|
|
|
{
|
|
|
- var pill = Round(hud, name, x, 18, w, 44, "21171A", border, 22, "0F0B10");
|
|
|
- var symbol = Image(pill.transform, icon, icon, 15, 11, 21, 21);
|
|
|
+ var pill = Round(hud, name, x, 1, w, 41, "21171A", border, 22, "0F0B10");
|
|
|
+ var symbol = Image(pill.transform, icon, icon, 14, 10, 21, 21);
|
|
|
symbol.uvRect = name == "Gold" ? new Rect(.17f, .17f, .66f, .66f) : new Rect(.20f, .18f, .6f, .64f);
|
|
|
symbol.color = Hex(accent);
|
|
|
- var label = Label(pill.transform, "", 37, 0, w - 46, 44, 22, Hex(accent), TextAnchor.MiddleCenter);
|
|
|
+ var label = Label(pill.transform, "", 37, 0, w - 45, 41, 22, Hex(accent), TextAnchor.MiddleCenter);
|
|
|
label.resizeTextForBestFit = true;
|
|
|
label.resizeTextMinSize = 12;
|
|
|
label.resizeTextMaxSize = 22;
|
|
|
@@ -230,10 +203,10 @@ namespace TowerDevil
|
|
|
}
|
|
|
Text StatCard(string caption, float x, string hi, string lo, string rim, string inset, Color ink)
|
|
|
{
|
|
|
- Round(hud, caption + " shadow", x, 82, 228, 78, "28171B", "241418", 21, "100B0E");
|
|
|
- var card = Round(hud, caption + " card", x, 77, 228, 78, hi, rim, 21, lo);
|
|
|
+ Round(hud, caption + " shadow", x, 53, 232, 68, "28171B", "241418", 21, "100B0E");
|
|
|
+ var card = Round(hud, caption + " card", x, 49, 232, 68, hi, rim, 21, lo);
|
|
|
card.stroke = 3;
|
|
|
- var badge = Round(card.transform, "Icon well", 17, 20, 40, 38, inset, inset, 12);
|
|
|
+ var badge = Round(card.transform, "Icon well", 15, 15, 40, 38, inset, inset, 12);
|
|
|
if (caption == "SEAL")
|
|
|
{
|
|
|
Shield(badge.transform, 11, 9, 18, 19, "77501D", "513714");
|
|
|
@@ -250,8 +223,8 @@ namespace TowerDevil
|
|
|
}
|
|
|
Round(badge.transform, "Sun", 13, 12, 14, 14, "FFF0D6", "FFF0D6", 7);
|
|
|
}
|
|
|
- var value = Label(card.transform, "", 70, 8, 145, 40, 30, ink);
|
|
|
- Label(card.transform, caption, 71, 45, 142, 23, 14, ink);
|
|
|
+ var value = Label(card.transform, "", 70, 4, 150, 34, 30, ink);
|
|
|
+ Label(card.transform, caption, 71, 38, 145, 23, 14, ink);
|
|
|
return value;
|
|
|
}
|
|
|
static void Shield(Transform parent, float x, float y, float width, float height, string top, string bottom)
|
|
|
@@ -263,18 +236,18 @@ namespace TowerDevil
|
|
|
}
|
|
|
void SideAction(string label, string glyph, float x, System.Action callback)
|
|
|
{
|
|
|
- var button = ButtonAt(actionArea, label, x, 0, 168, 82, callback, false, 18);
|
|
|
+ var button = ButtonAt(actionArea, label, x, 0, 186, 62, callback, false, 18);
|
|
|
StyleBattleButton(button, false);
|
|
|
var caption = button.GetComponentInChildren<Text>().rectTransform;
|
|
|
- caption.anchoredPosition = new Vector2(53, -2);
|
|
|
- caption.sizeDelta = new Vector2(94, 78);
|
|
|
- Image(button.transform, label + " icon", "ui_" + glyph, 37, 29, 24, 24).color = Ink;
|
|
|
+ caption.anchoredPosition = new Vector2(58, -2);
|
|
|
+ caption.sizeDelta = new Vector2(96, 58);
|
|
|
+ Image(button.transform, label + " icon", "ui_" + glyph, 40, 18, 27, 27).color = Ink;
|
|
|
}
|
|
|
void StyleBattleButton(Button button, bool primary)
|
|
|
{
|
|
|
var plate = (IronPanel)button.targetGraphic;
|
|
|
plate.rounded = true;
|
|
|
- plate.bevel = 24;
|
|
|
+ plate.bevel = 19;
|
|
|
plate.stroke = 3;
|
|
|
plate.top = Hex(primary ? "FFDC77" : "482932");
|
|
|
plate.bottom = Hex(primary ? "E89B22" : "2E1821");
|
|
|
@@ -288,13 +261,15 @@ namespace TowerDevil
|
|
|
string caption = run.Phase == Phase.Assault ? "HORDE ATTACKING"
|
|
|
: run.Phase == Phase.Rest ? "DONE"
|
|
|
: "LET THEM COME";
|
|
|
- var b = ButtonAt(actionArea, caption, 208, 0, 334, 82, BeginAttack, true, 23, run.CanArrange);
|
|
|
+ var b = ButtonAt(actionArea, caption, 219, 0, 312, 62, BeginAttack, true, 23, run.CanArrange);
|
|
|
StyleBattleButton(b, true);
|
|
|
b.name = "Primary";
|
|
|
- var label = b.GetComponentInChildren<Text>().rectTransform;
|
|
|
+ var captionText = b.GetComponentInChildren<Text>();
|
|
|
+ captionText.font = sans;
|
|
|
+ var label = captionText.rectTransform;
|
|
|
label.anchoredPosition = new Vector2(52, -2);
|
|
|
- label.sizeDelta = new Vector2(267, 78);
|
|
|
- Image(b.transform, "Sword", "ui_sword", 30, 25, 32, 32).color = Hex("342315");
|
|
|
+ label.sizeDelta = new Vector2(247, 58);
|
|
|
+ Image(b.transform, "Sword", "ui_sword", 27, 15, 32, 32).color = Hex("342315");
|
|
|
}
|
|
|
void BeginAttack()
|
|
|
{
|
|
|
@@ -337,6 +312,32 @@ namespace TowerDevil
|
|
|
RefreshHud();
|
|
|
}
|
|
|
|
|
|
+ static Vector2 SetRegion(RawImage image, Sprite sprite, bool flip)
|
|
|
+ {
|
|
|
+ Texture2D texture = sprite.texture;
|
|
|
+ Rect crop = sprite.rect;
|
|
|
+ var uv = new Rect(crop.x / texture.width, crop.y / texture.height,
|
|
|
+ crop.width / texture.width, crop.height / texture.height);
|
|
|
+ if (flip)
|
|
|
+ uv = new Rect(uv.xMax, uv.y, -uv.width, uv.height);
|
|
|
+ image.texture = texture;
|
|
|
+ image.uvRect = uv;
|
|
|
+ return crop.size;
|
|
|
+ }
|
|
|
+ void SetPieceArt(RawImage image, Piece piece, bool firing = false)
|
|
|
+ {
|
|
|
+ // The painted cannon points right at rest. A shot sets its actual facing;
|
|
|
+ // board re-layouts retain that facing until the next shot.
|
|
|
+ bool flip = piece.Kind == Kind.Cannon && (firing ? !piece.Reversed : image.uvRect.width < 0);
|
|
|
+ Vector2 size = SetRegion(image, courtSprites[piece.Art], flip);
|
|
|
+ image.name = piece.Art;
|
|
|
+ float footprint = piece.Kind switch {
|
|
|
+ Kind.Stone => .70f, Kind.Ice => .74f, Kind.Gold => .80f, Kind.Ballista => .91f,
|
|
|
+ Kind.Frost => .90f, Kind.Cannon => .86f, Kind.Arrow => .86f, _ => .77f
|
|
|
+ };
|
|
|
+ float span = BoardLayout.FrontCell * (footprint + .035f * (piece.Tier - 1));
|
|
|
+ image.rectTransform.sizeDelta = size * (span / Mathf.Max(size.x, size.y));
|
|
|
+ }
|
|
|
void DrawBoard(Piece[,] cells, Dictionary<RectTransform, Vector2> previous = null)
|
|
|
{
|
|
|
var used = new HashSet<Piece>();
|
|
|
@@ -349,18 +350,15 @@ namespace TowerDevil
|
|
|
used.Add(p);
|
|
|
if (!pieces.TryGetValue(p, out var image))
|
|
|
{
|
|
|
- float span = BoardLayout.FrontCell * (p.Tower ? 1.14f + .05f * (p.Tier - 1) :
|
|
|
- p.Kind == Kind.Chest ? 1.02f : 1f);
|
|
|
- image = Image(tiles, p.Art, p.Art, 0, 0, span, span);
|
|
|
+ image = Box(tiles, p.Art, 0, 0, 0, 0).gameObject.AddComponent<RawImage>();
|
|
|
+ image.raycastTarget = false;
|
|
|
image.rectTransform.pivot = new Vector2(.5f, 0);
|
|
|
pieces.Add(p, image);
|
|
|
}
|
|
|
- image.texture = Art(p.Art);
|
|
|
- image.uvRect = new Rect(p.Kind == Kind.Cannon && p.Reversed ? 1 : 0, 0,
|
|
|
- p.Kind == Kind.Cannon && p.Reversed ? -1 : 1, 1);
|
|
|
+ SetPieceArt(image, p);
|
|
|
var rt = image.rectTransform;
|
|
|
var center = BoardLayout.Center(r, c);
|
|
|
- var end = center + Vector2.down * (BoardLayout.Size(r) * (p.Tower ? .54f : .58f));
|
|
|
+ var end = center + Vector2.down * (BoardLayout.Depth(r) * .42f);
|
|
|
rt.localScale = Vector3.one * (BoardLayout.Size(r) / BoardLayout.FrontCell);
|
|
|
rt.SetAsLastSibling();
|
|
|
if (previous != null && !previous.ContainsKey(rt))
|
|
|
@@ -377,6 +375,12 @@ namespace TowerDevil
|
|
|
}
|
|
|
foreach (var key in removed)
|
|
|
pieces.Remove(key);
|
|
|
+ pieceShadows.SetVerticesDirty();
|
|
|
+ }
|
|
|
+ void LateUpdate()
|
|
|
+ {
|
|
|
+ if (route == "Run" && pieceShadows && (animating || held || run.Phase == Phase.Assault))
|
|
|
+ pieceShadows.SetVerticesDirty();
|
|
|
}
|
|
|
void UpdateRun()
|
|
|
{
|