コード例 #1
0
    // Use this for initialization
    void Start()
    {
        HealHP.SetActive(false);

        sound = this.gameObject.GetComponent <AudioSource> ();

        //3DTextの初期化
        textMesh      = transform.FindChild("PlayerLevel").GetComponent <TextMesh> ();
        textMesh.text = HP + "";
    }
コード例 #2
0
    void OnTriggerEnter(Collider col)
    {
        if (col.tag == "HPBall")
        {
            HP           += 10;
            textMesh.text = HP + "";
            HealHP.SetActive(false);
            HealHP.SetActive(true);
            col.gameObject.SetActive(false);

            sound.Play();
        }
    }