/// <summary> /// 初始化可能被频繁用到的预制体(因为常用,让他一直在内存里) /// </summary> protected override void InitWillUsedPrefabs() { BloodStrip bloodStrip = transform.gameObject.AddComponent <BloodStrip>(); bloodStrip.InitBloodStrip(mActorAttr); WillUsedPrefabs = new GameObject[3]; WillUsedPrefabs[0] = _AssetManager.GetGameObject("prefab/effect/bullet/yeguaibullet_prefab"); WillUsedPrefabs[0].SetActive(false); }
//blood strip public static void DestoryBloodStrip(long shipID) { if (_bloodStrips.ContainsKey(shipID)) { BloodStrip bloodStrip = _bloodStrips[shipID]; bloodStrip.Destory(); _bloodStrips.Remove(shipID); } }
public bool DisplayBloodStrip(long shipID, float val, Vector3 position, Vector3 offset) { // Profiler.BeginSample("BattleBloodControl.DisplayBloodStrip"); //_bloodStrips if (_bloodStrips.ContainsKey(shipID)) { //Debug.Log("Update Blood Strip"); BloodStrip bloodStrip = _bloodStrips[shipID]; bloodStrip.UpdateBloodStripValue(val, position, offset); } else { // Debug.Log("Create Blood Strip"); BloodStrip bloodStrip = new BloodStrip(progressBarBlood, shipID, val, position, offset); _bloodStrips.Add(shipID, bloodStrip); } // Profiler.EndSample(); return(true); }