private void TextUpdate() { string str = ""; for (int i = 0; i < displayStatusList.Count; ++i) { switch (displayStatusList[i]) { case EStatus.FPS: { float msec = Time.deltaTime * 1000.0f; float fps = 1.0f / Time.deltaTime; str += string.Format("{0:0.0} ms ({1:0.} fps)", msec, fps); } break; case EStatus.UNIT_COUNT: { str += "UNITS: " + Unit.unitList.Count.ToString(); } break; case EStatus.KEY: { str += "KEYS: [WASD], [1~3], Mouse"; } break; } str += "\n"; } TextDisplayer.UpdateText(gameObject, str); }
private void Update() { if (enableHpDisplay) { var pos = (Vector2)transform.position + new Vector2(0, 0.3f); TextDisplayer.UpdateText(gameObject, "HP: " + CurrentHp, pos); } }
private void Awake() { var rect = new Vector2(200f, 50f); var pos = new Vector2( -CameraManager.WorldWidthHalf, CameraManager.WorldHeightHalf); var worldRect = VEasyCalc.GuiToWorldPos(rect); pos.x += worldRect.x * 0.5f; pos.y -= worldRect.y * 0.5f; TextDisplayer.AssignNewText(gameObject, "", new Color(1, 1, 1), pos, rect, TextAnchor.UpperLeft); }
private void Awake() { // TODO 에디터에서 찾게 수정 if (owner == null) { owner = gameObject.GetComponent <Unit>(); } owner.unitStatus = this; if (enableVitalColor && sprite == null) { sprite = GetComponent <SpriteRenderer>(); } if (enableHpDisplay) { var pos = (Vector2)transform.position + new Vector2(0, 0.3f); TextDisplayer.AssignNewText(gameObject, "", new Color(1, 0, 0) , pos, new Vector2(50, 20), TextAnchor.MiddleCenter); } }
private void OnDisable() { TextDisplayer.RemoveText(gameObject); }