// Start is called before the first frame update void Start() { rwzd = gameObject.transform.parent.transform.Find("牧师").GetComponent <人物战斗>(); 实时经验文本 = gameObject.transform.Find("拓展栏").transform.Find("经验文本").GetComponent <Text>(); 经验条 = gameObject.transform.Find("经验条").GetComponent <Slider>(); 经验读取(); }
public void 初始状态(人物战斗 rwzd) { Text 初始文本 = gameObject.transform.Find("初始状态").GetComponent <Text>(); 初始文本.text = "人物: 牧师 等级: " + rwzd.等级; //经验文本刷新(); //经验条刷新(); }
// Start is called before the first frame update void Start() { //获取预制体 扣血文本 = Resources.Load <GameObject>("Prefabs/扣血文本"); 血条 = gameObject.GetComponent <Slider>(); dtgw = GameObject.Find("画布").GetComponent <地图怪物_工具>(); 常用场景脚本 = GameObject.Find("画布").GetComponent <常用场景脚本>(); 人物属性 = GameObject.Find("牧师_all").transform.Find("状态栏").GetComponent <actor>(); g_m = gameObject.transform.parent.gameObject.GetComponent <get_monster>(); if (gameObject.tag.Equals("怪物")) { 初始化(); } 原来坐标 = transform.position; 攻击坐标 = new Vector3(transform.localPosition.x, transform.localPosition.y - 10, transform.localPosition.z); 攻击目标 = GameObject.Find("牧师"); rw = 攻击目标.GetComponent <人物战斗>(); }
int 攻击(人物战斗 rw) { transform.position = Vector3.MoveTowards(transform.position, 攻击坐标, 20); //判断人物是否还有生命 if (rw.剩余血量 > 0) { //攻击 int 扣血_ = 攻击力 - rw.总_防御力;; //判断是否破防,不破防伤害为0 扣血 = 扣血_ >= 0 ? 扣血_ : 0; rw.扣血显示(扣血); } else { isAttack = false; } rw.剩余血量 -= 扣血; return(扣血); }
private void Start() { gwzd = gameObject.transform.parent.GetComponent <怪物战斗>(); rwzd = GameObject.Find("牧师").GetComponent <人物战斗>(); }
// Start is called before the first frame update void Start() { rwzd = GameObject.Find("牧师").GetComponent <人物战斗>(); 人物面板 = GameObject.Find("牧师").GetComponent <actor>(); }