public void AddScores(Vector3 worldPos, int scores, int sumscores, bool iscombo, bool createLabel = true) { if (createLabel) { GameObject labelObj; Vector3 pos = GameCommon.WorldPosToNGUIPos(Camera.main, UICamera.currentCamera, worldPos); if (iscombo) { labelObj = NGUITools.AddChild(uiroot, addScoresComboLabelRes); AddScoresComboLabel label = labelObj.GetComponent <AddScoresComboLabel>(); label.Init(pos, scores); label.transform.position = pos; } else { labelObj = NGUITools.AddChild(uiroot, addScoresLabelRes); AddScoresLabel label = labelObj.GetComponent <AddScoresLabel>(); label.Init(pos, scores); label.transform.position = pos; } //GameObject labelObj = MonoBehaviour.Instantiate(addScoresLabelRes); } gamePadManager.SetScores(sumscores, iscombo); }
// Update is called once per frame public void InGameUIPlayerInfoUnitUpdate() { if (!GameCommon.IsPositionInScreen(role.transform.position)) { gameObject.SetActive(false); return; } showTime -= Time.deltaTime; if (showTime <= 0) { gameObject.SetActive(false); } else { gameObject.SetActive(true); } //血条 float toval = (float)role.life / (float)role.propertys.GetProperty(enCharacterProperty.life); if (Mathf.Abs(toval - lifeSprite.fillAmount) > 0.01f) { showTime = 3f; } float addval = (toval - lifeSprite.fillAmount) * 0.1f; lifeSprite.fillAmount = toval + addval; //更新位置 if (Camera.main == null || UICamera.currentCamera == null) { return; } transform.position = GameCommon.WorldPosToNGUIPos( Camera.main, UICamera.currentCamera, role.transform.position + new Vector3(0, role.boxSize.y, 0));//+ basePos; transform.localPosition += basePos; }
// Update is called once per frame void Update() { actionTimeUpdate += Time.deltaTime; if (actionTimeUpdate >= actionTime) { Destroy(gameObject); return; } float rate = Mathf.Clamp(actionTimeUpdate / actionTime, 0f, 1f); Vector3 p = basePos + actionPos * positionAnim.Evaluate(rate); transform.position = GameCommon.WorldPosToNGUIPos( Camera.main, UICamera.currentCamera, p); transform.localScale = Vector3.one * baseScale * scaleAnim.Evaluate(rate); label.color = new Color(label.color.r, label.color.g, label.color.b, opacityAnim.Evaluate(rate)); }