private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Player") { //道具效果 other.GetComponent <buffShow>().showMovespeed(); Porp.resetPorpCreat(); GameObject.Destroy(this.gameObject); } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Player") { other.GetComponent <buffShow>().showDefence(); defenceSlider = other.transform.Find("Shield/Slider").GetComponent <Slider>(); //道具效果 if (other.GetComponent <PlayerTank>().defence < 60) { other.GetComponent <PlayerTank>().defence += 20; defenceSlider.value = other.GetComponent <PlayerTank>().defence / 20; Debug.Log("123214324325"); } Porp.resetPorpCreat(); GameObject.Destroy(this.gameObject); Debug.Log("防御"); } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Player") { other.GetComponent <buffShow>().showHp(); HPSlider = other.transform.Find("HUD/Canvas/Slider").GetComponent <Slider>(); //道具效果 other.GetComponent <PlayerTank>().currHP += 10; if (other.GetComponent <PlayerTank>().currHP <= other.GetComponent <PlayerTank>().HP) { HPSlider.value = other.GetComponent <PlayerTank>().currHP / other.GetComponent <PlayerTank>().HP; } else { other.GetComponent <PlayerTank>().currHP = other.GetComponent <PlayerTank>().HP; HPSlider.value = 1; } Porp.resetPorpCreat(); GameObject.Destroy(this.gameObject); Debug.Log("加血"); } }