finished gate book

This commit is contained in:
klemek
2020-12-22 19:11:55 +01:00
parent ac85bdcdf2
commit 13718af6da
9 changed files with 232 additions and 45 deletions
+8 -5
View File
@@ -48,10 +48,13 @@ namespace CompuLogic.Workspace
{
Text.text = Name;
var rect = Text.GetComponent<RectTransform>();
rect.localRotation = (Mathf.Abs(Orientation.y) > Mathf.Epsilon) ? Quaternion.AngleAxis(90f, Vector3.forward) : Quaternion.identity;
rect.localPosition = new Vector3(Orientation.x, Orientation.y, 0f) * TextSpace;
Text.alignment = (Orientation.x < -Mathf.Epsilon || Orientation.y < -Mathf.Epsilon) ? TextAlignmentOptions.MidlineRight : TextAlignmentOptions.MidlineLeft;
var rotate = (Mathf.Abs(Orientation.y) > Mathf.Epsilon && Name.Length > 1);
rect.localRotation = rotate ? Quaternion.AngleAxis(90f, Vector3.forward) : Quaternion.identity;
rect.localPosition = new Vector3(Orientation.x, Orientation.y, 0f) * -TextSpace;
if (!rotate && Mathf.Abs(Orientation.y) > Mathf.Epsilon)
Text.alignment = (Orientation.y < -Mathf.Epsilon) ? TextAlignmentOptions.Bottom : TextAlignmentOptions.Top;
else
Text.alignment = (Orientation.x < -Mathf.Epsilon || Orientation.y < -Mathf.Epsilon) ? TextAlignmentOptions.MidlineLeft : TextAlignmentOptions.MidlineRight;
}
}
}
@@ -95,7 +98,7 @@ namespace CompuLogic.Workspace
Utils.RandomName($"{Gate.GateType}_{Name}", gameObject);
_scale = Sprite.transform.localScale;
Cables = new List<Cable>();
Orientation = Orientation.normalized;
//Orientation = Orientation.normalized;
}
// Update is called once per frame