小屋創作

日誌2017-06-24 15:27

Slider (HP,MP.......)+(數字跳出)

作者:麋瑀

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class NewBehaviourScript6 : MonoBehaviour
{

    public Slider healthbar; //敵人的Slider
    static Animator anim;
    public Collider ch;//指定剛體

    void OnTriggerEnter(Collider other)
    {
        if (other == ch)
        {
        int i = Random.Range(5, 10);//亂數
            healthbar.value -= i;
            FloatingTextController.CreateFloatingText(i.ToString(), transform);

        }

        if (healthbar.value <= 0)
        anim.SetBool("death", true);//死亡動畫
    }

    // Use this for initialization
    void Start()
    {
        FloatingTextController.Initialize();
        anim = GetComponent<Animator> ();
    }

    // Update is called once per frame
    void Update()
    {

    }
}

----------------------------------------------------------------------------------------------------------------------------
跳出數字(攻擊會跳出數字)-(1)
跳出數字(攻擊會跳出數字)-(2)

1

0

LINE 分享

相關創作

認識AI工具的三種等級

閱讀五月天,悅讀每一天【文學星官方活動】

說別人開分身帳號,結果自己也是分身帳號(聳肩

留言

開啟 APP

face基於日前微軟官方表示 Internet Explorer 不再支援新的網路標準,可能無法使用新的應用程式來呈現網站內容,在瀏覽器支援度及網站安全性的雙重考量下,為了讓巴友們有更好的使用體驗,巴哈姆特即將於 2019年9月2日 停止支援 Internet Explorer 瀏覽器的頁面呈現和功能。
屆時建議您使用下述瀏覽器來瀏覽巴哈姆特:
。Google Chrome(推薦)
。Mozilla Firefox
。Microsoft Edge(Windows10以上的作業系統版本才可使用)

face我們了解您不想看到廣告的心情⋯ 若您願意支持巴哈姆特永續經營,請將 gamer.com.tw 加入廣告阻擋工具的白名單中,謝謝 !【教學】