// 创建生命条 FloatBar CreateBar(Transform trans, int val, int maxValue) { GameObject gameObject = Instantiate(prefab, healthBarRoot, false); FloatBar floatBar = gameObject.GetComponent <FloatBar>(); healthbars.Add(floatBar); //floatBar.OnUse(trans, val, maxValue); return(floatBar); }
private void Awake() { patrol = GetComponent <EnemyPatrol>(); enemy = GetComponent <EnemyPlayer>(); floatBar = GetComponentInChildren <FloatBar>(); }