Esempio n. 1
0
        /// <summary>
        /// 伤害显示
        /// </summary>
        public IEnumerator ShowDamageText(PlayerUI thisPlayer, float damage)
        {
            int   directionModify = 1;
            float duration        = 0f;

            /*if (currentPerson.position.x < transform.position.x){
             *  directionModify = 1;
             * }else{
             *  directionModify = -1;
             * }*/
            thisPlayer.damageText.text = $"-{damage}";
            Vector3 direction = new Vector3(Random.Range(0, 100), Random.Range(0, 100), 0) * directionModify;

            thisPlayer.damageText.gameObject.SetActive(true);
            while (duration < textTime)
            {
                duration += sliderSpeed * Time.deltaTime;
                thisPlayer.damageText.transform.Translate(direction.normalized * textVelocity * Time.deltaTime, Space.World);
                yield return(new WaitForEndOfFrame());
            }
            thisPlayer.damageText.gameObject.SetActive(false);
            thisPlayer.damageText.transform.position = thisPlayer.damageTextOriginalPos;
        }
Esempio n. 2
0
 /// <summary> 修改血条上的文本 </summary>
 public void UpdateBloodText(PlayerUI thisPlayer)
 {
     thisPlayer.hpInBarSliderText.text = $"{thisPlayer.healthPoint} / {thisPlayer.maxHealthPoint}";
 }