void Update() { screenX = Mathf.Clamp01(screenX); screenY = Mathf.Clamp01(screenY); float camSize = Camera.main.orthographicSize; textMesh.transform.localScale = new Vector3(scaleRatio * camSize, scaleRatio * camSize, 1.0f); int x = (int)(screenX * Screen.width); int y = (int)(Screen.height - screenY * Screen.height); Vector3 textWorldPos = new Vector3(x, y, 0.0f); textWorldPos = Camera.main.ScreenToWorldPoint(new Vector3(x, y, 0.0f)); this.transform.position = textWorldPos; textMesh.color = world.triColor; System.Text.StringBuilder builder = new System.Text.StringBuilder(); builder.AppendLine("TOTAL:" + world.getAllTimeScore().ToString()); builder.AppendLine("AVAIL:" + world.getScore().ToString()); builder.Append(getUpgradesProgress()); textMesh.text = builder.ToString(); }
bool parseUpgradePayment(string command) { foreach (Candidate c in System.Enum.GetValues(typeof(Candidate))) { string s = command; if (upgradeWithoutSum && c.ToString() == command) { return(world.payTowardsupgrade(c, world.getScore())); } if (upgradeWithoutSum) { continue; } s = s.Replace(c.ToString(), ""); int payment; if (int.TryParse(s, out payment)) { return(world.payTowardsupgrade(c, payment)); } } return(false); }