void OnDestroy() { emitEffectFont = null; }
public void SyncPropComponent(GameData.BattleGameData.Fleet fleetData, GirlData data, bool isNpc, GameData.BattleGameData.Ship battleShipData) { if (null == data) { return; } ShipData = data; if (null == Property) { Property = gameObject.GetComponent <WarshipProperty>() as WarshipProperty; if (null == Property) { Property = gameObject.AddComponent(typeof(WarshipProperty)) as WarshipProperty; } } Property.WarshipFleetID = fleetData.FleetID; Property.WarshipIsAttacker = fleetData.IsAttacker; Property.WarshipIsNpc = isNpc; Property.WarshipID = data.roleCardId; // Property.WarshipLogicID = data.BasicData.LogicID; // Property.Name = data.BasicData.Name; // Property.WarshipIcon = data.BasicData.Icon; // // Property.WarshipType = (int)data.BasicData.Type; // Property.TypeID = (int)data.BasicData.TypeID; // //Property.WarshipCurrentLife = data.PropertyData.Life; //Property.WarshipSimulateLife = data.PropertyData.Life; Property.WarshipCurrentLife = battleShipData.InitialCurrentLife; Property.WarshipSimulateLife = battleShipData.InitialCurrentLife; //Property.WarshipMaxLife = data.PropertyData.MaxLife; Property.WarshipCurrentPower = data.PropertyData.Power; Property.WarshipSimulatePower = data.PropertyData.Power; Property.WarshipMaxPower = 100; Property.CurrentFillSpeed = data.PropertyData.FillSpeed; if (0 == Property.WarshipMaxLife) { Debug.LogError("The dividend is 0"); return; } progressBG.transform.localScale = Vector3.zero; lifeProgress.transform.localScale = Vector3.zero; powerProgress.transform.localScale = Vector3.zero; UpdateLifeProgress((float)Property.WarshipSimulateLife); UpdatePowerProgress((float)Property.WarshipSimulatePower); if (null == emitEffectFont) { emitEffectFont = gameObject.GetComponent <EmitEffectFontUtil>() as EmitEffectFontUtil; if (null == emitEffectFont) { emitEffectFont = gameObject.AddComponent(typeof(EmitEffectFontUtil)) as EmitEffectFontUtil; } } mPublisher.NotifyCreate(this); }