private void SynchronizeEffectPropertyToPrefab() { string effectPathFormat = "Assets/Resources/{0}.prefab"; int recordCount = CDataMgr.Effects.GetRecordCount(); for (int i = 0; i < recordCount; ++i) { int id = CDataMgr.Effects.GetDataByNumber <int>(i, 0); ModelEffects modelEffects = new ModelEffects(); modelEffects.LoadConfig(id); string effectPathName = string.Format(effectPathFormat, modelEffects.name_); GameObject effectGameObject = AssetDatabase.LoadAssetAtPath(effectPathName, typeof(GameObject)) as GameObject; if (effectGameObject != null) { EffectController effectController = effectGameObject.GetComponent <EffectController>(); if (effectController == null) { effectController = effectGameObject.AddComponent <EffectController>(); } effectController.bindPosition = modelEffects.bind_pos_; effectController.canBreakOff = modelEffects.can_break_off_; effectController.canHitPause = modelEffects.can_hit_pause_; effectController.effectType = (int)modelEffects.effect_type_; } } }
private void TransferInt2Field(SimpleStateMachineData.SimpleAnimationEventData simpleAnimationEventData) { if (simpleAnimationEventData != null) { ValidateInt2AssetPathNames(simpleAnimationEventData); int length = simpleAnimationEventData.intVals2.Length; for (int i = 0; i < length; ++i) { if (simpleAnimationEventData.funcNames[i] == "PlayEffect" && simpleAnimationEventData.intVals2[i] != 0) { ModelEffects modelEffects = new ModelEffects(); if (modelEffects.LoadConfig(simpleAnimationEventData.intVals2[i])) { simpleAnimationEventData.objectAssetPathNames[i] = modelEffects.name_; } else { Debug.Log(simpleAnimationEventData.intVals2[i] + "doesn't exist in table"); } } } } }