Separate defense build branches from enemy lanes
This commit is contained in:
@@ -964,6 +964,19 @@ namespace BumpCombat.Defense
|
||||
CreateLaneLine(lane, portal, tuning.GetWaypointPosition(lane, 0));
|
||||
CreateLaneLine(lane, tuning.GetWaypointPosition(lane, 0), tuning.GetWaypointPosition(lane, 1));
|
||||
CreateLaneLine(lane, tuning.GetWaypointPosition(lane, 1), basePosition);
|
||||
|
||||
int[] padOrder = lane == 0
|
||||
? new[] { 3, 4, 0 } : new[] { 1, 5, 2 };
|
||||
Vector2 branchCorner = new(
|
||||
basePosition.x, tuning.GetBuildPadPosition(padOrder[0]).y);
|
||||
CreateLaneLine(lane, basePosition, branchCorner, true, 1);
|
||||
Vector2 branchPoint = branchCorner;
|
||||
for (int i = 0; i < padOrder.Length; i++)
|
||||
{
|
||||
Vector2 padPosition = tuning.GetBuildPadPosition(padOrder[i]);
|
||||
CreateLaneLine(lane, branchPoint, padPosition, true, i + 2);
|
||||
branchPoint = padPosition;
|
||||
}
|
||||
CreateShape(
|
||||
$"Portal {lane + 1}",
|
||||
portal,
|
||||
@@ -999,7 +1012,8 @@ namespace BumpCombat.Defense
|
||||
3);
|
||||
CreateWorldLabel(
|
||||
$"Build Pad {pad + 1} Label",
|
||||
position + Vector2.down * 0.95f,
|
||||
position + (position.y >= tuning.ArenaCenter.y
|
||||
? Vector2.down : Vector2.up) * 0.95f,
|
||||
"PAD " + (pad + 1));
|
||||
}
|
||||
}
|
||||
@@ -1060,21 +1074,29 @@ namespace BumpCombat.Defense
|
||||
+ upgrade;
|
||||
}
|
||||
|
||||
private void CreateLaneLine(int lane, Vector2 from, Vector2 to)
|
||||
private void CreateLaneLine(
|
||||
int lane, Vector2 from, Vector2 to,
|
||||
bool padBranch = false, int segment = 0)
|
||||
{
|
||||
GameObject lineObject = new($"Lane {lane + 1} Segment");
|
||||
string name = padBranch
|
||||
? $"Pad Branch {lane + 1} Segment {segment}"
|
||||
: $"Lane {lane + 1} Segment";
|
||||
GameObject lineObject = new(name);
|
||||
lineObject.transform.SetParent(worldRoot.transform, false);
|
||||
LineRenderer line = lineObject.AddComponent<LineRenderer>();
|
||||
line.useWorldSpace = true;
|
||||
line.positionCount = 2;
|
||||
line.SetPosition(0, from);
|
||||
line.SetPosition(1, to);
|
||||
line.startWidth = 0.08f;
|
||||
line.endWidth = 0.08f;
|
||||
line.startColor = new Color32(108, 151, 177, 210);
|
||||
line.endColor = new Color32(108, 151, 177, 210);
|
||||
line.startWidth = padBranch ? 0.12f : 0.08f;
|
||||
line.endWidth = line.startWidth;
|
||||
Color32 color = padBranch
|
||||
? new Color32(91, 206, 160, 225)
|
||||
: new Color32(108, 151, 177, 210);
|
||||
line.startColor = color;
|
||||
line.endColor = color;
|
||||
line.material = new Material(Shader.Find("Sprites/Default"));
|
||||
line.sortingOrder = 1;
|
||||
line.sortingOrder = padBranch ? 2 : 1;
|
||||
}
|
||||
|
||||
private GameObject CreateShape(
|
||||
|
||||
Reference in New Issue
Block a user