private static void ExportScheme_Area(LightingEffect scheme) { if (scheme == null) { return; } LightingEffect_Area areaScheme = scheme as LightingEffect_Area; if (areaScheme == null) { return; } //Area string startTick = areaScheme.effectStartTick.ToString(); string intervalTick = areaScheme.effectIntervalTick.ToString(); string subEffectID = areaScheme.subEffectID.ToString(); string posBindBone = areaScheme.posBindBone; string customOffset = areaScheme.customOffset.x + ";" + areaScheme.customOffset.y + ";" + areaScheme.customOffset.z; string projOnGround = (areaScheme.projectOnGround ? 1 : 0).ToString(); string extentToMaxDis = (areaScheme.extentToMaxDistance ? 1 : 0).ToString(); string effectCount = areaScheme.effectCount.ToString(); string effectTotalTick = areaScheme.effectTotalTick.ToString(); ExportSchemeInfo(areaScheme, startTick, intervalTick, subEffectID, posBindBone, customOffset, projOnGround, extentToMaxDis, effectCount, effectTotalTick); }
public override void FillData(LightingEffect effectConfig, LightEffectParam param, LightingEffectResHandleInstance instance, Transform transformAgent) { base.FillData(effectConfig, param, instance, transformAgent); this.areaConfig = effectConfig as LightingEffect_Area; if (!areaConfig && effectConfig) { Debug.LogWarning(effectConfig.nID + "配置不匹配,创建光效失败---" + GetType().ToString()); } }
void AddSchemeNode(int nType, ScpReader reader, int row) { switch (nType) { case (int)LightingEffectConfigType.Bind: { LightingEffect_Bind bindEffect = ScriptableObject.CreateInstance <LightingEffect_Bind>(); FillBaseData(bindEffect, reader, row); bindEffect.bCreateOutsideScreen = reader.GetInt(row, (int)Column_Bind.COL_CREATEOUTSCREEN, 0) > 0 ? true : false; bindEffect.scale = reader.GetFloat(row, (int)Column_Bind.COL_SCALE, 0); bindEffect.effectStartTick = reader.GetInt(row, (int)Column_Bind.COL_STARTTICK, 0); bindEffect.effectLiveTick = reader.GetInt(row, (int)Column_Bind.COL_LIVETICK, 0); bindEffect.effectDispearTick = reader.GetInt(row, (int)Column_Bind.COL_DISPEARTICK, 0); bindEffect.posBindBone = reader.GetString(row, (int)Column_Bind.COL_POSBINDBONE, ""); string[] posOffsetStrArry = reader.GetString(row, (int)Column_Bind.COL_POSOFFSET, "").Split(';'); bindEffect.posOffset = StrArry2Vector3(posOffsetStrArry); bindEffect.rotationBindBone = reader.GetString(row, (int)Column_Bind.COL_ROTBINDBONE, ""); string[] rotationOffsetStrArry = reader.GetString(row, (int)Column_Bind.COL_ROTOFFSET, "").Split(';'); bindEffect.rotationOffset = StrArry2Vector3(rotationOffsetStrArry); bindEffect.faceToCamera = reader.GetInt(row, (int)Column_Bind.COL_FACETOCAM, 0) > 0 ? true : false; bindEffect.offsetToSurface = reader.GetInt(row, (int)Column_Bind.COL_OFFSETTOSURFACE, 0) > 0 ? true : false; int bindType = reader.GetInt(row, (int)Column_Bind.COL_BINDTYPE, 0); if (Enum.IsDefined(typeof(BindType), bindType)) { bindEffect.bindType = (BindType)bindType; } bindEffect.faceAganistTarget = reader.GetInt(row, (int)Column_Bind.COL_FACEAGNISTTARGET, 0) > 0 ? true : false; bindEffect.bProjectOnFloor = reader.GetInt(row, (int)Column_Bind.COL_PROJONFLOOR, 0) > 0 ? true : false; bindEffect.faceToWalkingDirection = reader.GetInt(row, (int)Column_Bind.COL_FACETOWALKINGDIR, 0) > 0 ? true : false; bindEffect.bNotRotate = reader.GetInt(row, (int)Column_Bind.COL_NOTROTATE, 0) > 0 ? true : false; bindEffect.bindTargetToSource = reader.GetInt(row, (int)Column_Bind.COL_BINDTARGETTOSRC, 0) > 0 ? true : false; bindEffect.bindTargetBone = reader.GetString(row, (int)Column_Bind.COL_BINDTARGETBONE, ""); bindEffect.triggerHitDetect = reader.GetInt(row, (int)Column_Bind.COL_TRIGGERHITDETECT, 0) > 0 ? true : false; bindEffect.SoundID = reader.GetInt(row, (int)Column_Bind.COL_SOUND, 0); bindEffect.posBindWound = reader.GetString(row, (int)Column_Bind.COL_POSBINDWOUND, ""); AddLightEffect(bindEffect); } break; case (int)LightingEffectConfigType.Fly: { LightingEffect_Fly flyEffect = ScriptableObject.CreateInstance <LightingEffect_Fly>(); FillBaseData(flyEffect, reader, row); flyEffect.scale = reader.GetFloat(row, (int)Column_Fly.COL_SCALE, 0); flyEffect.effectStartTick = reader.GetInt(row, (int)Column_Fly.COL_STARTTICK, 0); flyEffect.effectLiveTick = reader.GetInt(row, (int)Column_Fly.COL_LIVETICK, 0); flyEffect.residenceTick = reader.GetInt(row, (int)Column_Fly.COL_RESIDENCETICK, 0); flyEffect.effectDispearTick = reader.GetInt(row, (int)Column_Fly.COL_DISPEARTICK, 0); flyEffect.maxDistance = reader.GetFloat(row, (int)Column_Fly.COL_MAXDISTANCE, 0); flyEffect.posBindBone = reader.GetString(row, (int)Column_Fly.COL_POSBINDBONE, ""); flyEffect.rotationBindBone = reader.GetString(row, (int)Column_Fly.COL_ROTATIONBINDBONE, ""); string[] posOffsetStrArry = reader.GetString(row, (int)Column_Fly.COL_POSOFFSET, "").Split(';'); flyEffect.posOffset = StrArry2Vector3(posOffsetStrArry); string[] startPosOffsetStrArry = reader.GetString(row, (int)Column_Fly.COL_STARTPOSOFFSET, "").Split(';'); flyEffect.startPosOffset = StrArry2Vector3(startPosOffsetStrArry); flyEffect.targetTransformBone = reader.GetString(row, (int)Column_Fly.COL_TARGETTRSBONE, ""); string[] targetOffsetStrArry = reader.GetString(row, (int)Column_Fly.COL_TARGETOFFSET, "").Split(';'); flyEffect.targetOffset = StrArry2Vector3(targetOffsetStrArry); int flyType = reader.GetInt(row, (int)Column_Fly.COL_FLYTYPE, 0); if (Enum.IsDefined(typeof(FlyType), flyType)) { flyEffect.flyType = (FlyType)flyType; } int StartType = reader.GetInt(row, (int)Column_Fly.COL_STARTTYPE, 0); if (Enum.IsDefined(typeof(StartPosType), StartType)) { flyEffect.startType = (StartPosType)StartType; } flyEffect.faceTarget = reader.GetInt(row, (int)Column_Fly.COL_FACETARGET, 0) > 0 ? true : false; flyEffect.lowestHeight = reader.GetFloat(row, (int)Column_Fly.COL_LOWESTHEIGHT, 0); flyEffect.highestHeight = reader.GetFloat(row, (int)Column_Fly.COL_HIGHESTHEIGHT, 0); flyEffect.flySpeed = reader.GetFloat(row, (int)Column_Fly.COL_FLYSPEED, 0); flyEffect.AbsFlyTime = reader.GetFloat(row, (int)Column_Fly.COL_ABSFLYTIME, 0); flyEffect.destroyWhenReached = reader.GetInt(row, (int)Column_Fly.COL_DESTROYWHENREACHED, 0) > 0 ? true : false; flyEffect.destroyWhenTargetDead = reader.GetInt(row, (int)Column_Fly.COL_DESTROYWHENTARGETDEAD, 0) > 0 ? true : false; flyEffect.useCollision = reader.GetInt(row, (int)Column_Fly.COL_USECOLLISION, 0) > 0 ? true : false; flyEffect.destroyWhenCollision = reader.GetInt(row, (int)Column_Fly.COL_DESTROYWHENCOLLISION, 0) > 0 ? true : false; flyEffect.reviseFly = reader.GetInt(row, (int)Column_Fly.COL_REVISEFLY, 0) > 0 ? true : false; flyEffect.effectReturn = reader.GetInt(row, (int)Column_Fly.COL_EFFECTRETURN, 0) > 0 ? true : false; flyEffect.closeReturn = reader.GetInt(row, (int)Column_Fly.COL_CLOSERETURN, 0) > 0 ? true : false; flyEffect.returnSpeed = reader.GetFloat(row, (int)Column_Fly.COL_RETURNSPEED, 0); flyEffect.faceSourceToTarget = reader.GetFloat(row, (int)Column_Fly.COL_FACESRCTOTARGET, 0) > 0 ? true : false; flyEffect.effectIDWhenHitPlayer = reader.GetString(row, (int)Column_Fly.COL_EFFECTIDHITPLAYER, ""); flyEffect.effectIDWhenHitMonster = reader.GetString(row, (int)Column_Fly.COL_EFFECTIDHITMONSTER, ""); flyEffect.effectIDWhenHitGround = reader.GetString(row, (int)Column_Fly.COL_EFFECTIDHITGROUND, ""); flyEffect.effectIDWhenReached = reader.GetString(row, (int)Column_Fly.COL_EFFECTIDREACH, ""); flyEffect.triggerHitDetect = reader.GetInt(row, (int)Column_Fly.COL_TRIGGERHITDETECT, 0) > 0 ? true : false; flyEffect.playAnimWhenClose = reader.GetString(row, (int)Column_Fly.COL_PLAYANIMWHENCLOSE, ""); flyEffect.upcastMotion = reader.GetFloat(row, (int)Column_Fly.COL_UPCASTMOTION, 0) > 0 ? true : false; flyEffect.upcastHeight = reader.GetFloat(row, (int)Column_Fly.COL_UPCASTHEIGHT, 0); flyEffect.minUpcastAngle = reader.GetFloat(row, (int)Column_Fly.COL_MINUPCASTANGLE, 0); flyEffect.maxUpcastAngle = reader.GetFloat(row, (int)Column_Fly.COL_MAXUPCASTANGLE, 0); flyEffect.upcastTopPrec = reader.GetFloat(row, (int)Column_Fly.COL_UPCASTTOPPREC, 0); flyEffect.SoundID = reader.GetInt(row, (int)Column_Fly.COL_SOUND, 0); flyEffect.delayDestroyTick = reader.GetInt(row, (int)Column_Fly.COL_DELAYDESTROYTICK, 0); flyEffect.delayHideTick = reader.GetInt(row, (int)Column_Fly.COL_DELAYHIDETICK, 0); flyEffect.attackToObject = reader.GetInt(row, (int)Column_Fly.COL_ATTACKTOOBJECT, 0) > 0 ? true : false; flyEffect.AffectedShield = reader.GetInt(row, (int)Column_Fly.COL_AFFECTSHIELD, 0) > 0 ? true : false; AddLightEffect(flyEffect); } break; case (int)LightingEffectConfigType.AniReplace: { LightingEffect_AnimationReplace aniReplaceEffect = ScriptableObject.CreateInstance <LightingEffect_AnimationReplace>(); FillBaseData(aniReplaceEffect, reader, row); aniReplaceEffect.nStartTick = reader.GetInt(row, (int)Column_AnimReplace.COL_STARTTICK, 0); aniReplaceEffect.nEndTick = reader.GetInt(row, (int)Column_AnimReplace.COL_ENDTICK, 0); AddLightEffect(aniReplaceEffect); } break; case (int)LightingEffectConfigType.Area: { LightingEffect_Area areaEffect = ScriptableObject.CreateInstance <LightingEffect_Area>(); FillBaseData(areaEffect, reader, row); areaEffect.effectStartTick = reader.GetInt(row, (int)Column_Area.COL_STARTTICK, 0); areaEffect.effectIntervalTick = reader.GetInt(row, (int)Column_Area.COL_INTERVTICK, 0); areaEffect.subEffectID = reader.GetInt(row, (int)Column_Area.COL_SUBEFFECTID, 0); areaEffect.posBindBone = reader.GetString(row, (int)Column_Area.COL_POSBINDBONE, ""); string[] customOffStrArry = reader.GetString(row, (int)Column_Area.COL_CUSTOMOFFSET, "").Split(';'); areaEffect.customOffset = StrArry2Vector3(customOffStrArry); areaEffect.projectOnGround = reader.GetInt(row, (int)Column_Area.COL_PROJONGROUND, 0) > 0 ? true : false; areaEffect.extentToMaxDistance = reader.GetInt(row, (int)Column_Area.COL_EXTENTTOMAXDIS, 0) > 0 ? true : false; areaEffect.effectCount = reader.GetInt(row, (int)Column_Area.COL_EFFECTCOUNT, 0); areaEffect.effectTotalTick = reader.GetInt(row, (int)Column_Area.COL_EFFECTTOTALTICK, 0); AddLightEffect(areaEffect); } break; case (int)LightingEffectConfigType.Camera: { LightingEffect_Camera camEffect = ScriptableObject.CreateInstance <LightingEffect_Camera>(); FillBaseData(camEffect, reader, row); int animOrgPos = reader.GetInt(row, (int)Column_Camera.COL_ANIMORGPOS, 0); if (Enum.IsDefined(typeof(Effect.CameraAnimOrgType), animOrgPos)) { camEffect.animationOrgPos = (Effect.CameraAnimOrgType)animOrgPos; } camEffect.animationOrgProjectFloor = reader.GetInt(row, (int)Column_Camera.COL_ANIMORGPROJFLOOR, 0) > 0 ? true : false; camEffect.animationMainCamera = reader.GetInt(row, (int)Column_Camera.COL_ANIMMAINCAM, 0) > 0 ? true : false; int attackType = reader.GetInt(row, (int)Column_Camera.COL_ATTACKTYPE, 0); if (Enum.IsDefined(typeof(Effect.EffectAttackType), attackType)) { camEffect.attackType = (Effect.EffectAttackType)attackType; } camEffect.effectRad = reader.GetFloat(row, (int)Column_Camera.COL_EFFECTRAD, 0f); camEffect.effectLiveTick = reader.GetInt(row, (int)Column_Camera.COL_EFFECTLIVETICK, 0); camEffect.delayTick = reader.GetInt(row, (int)Column_Camera.COL_DELAYTICK, 0); camEffect.effectFinishTick = reader.GetInt(row, (int)Column_Camera.COL_EFFECTFINISHTICK, 0); camEffect.recoverTransform = reader.GetInt(row, (int)Column_Camera.RECOVERTRANSFORM, 0) > 0 ? true : false; AddLightEffect(camEffect); } break; case (int)LightingEffectConfigType.Shadow: { LightingEffect_Shadow shadowEffect = ScriptableObject.CreateInstance <LightingEffect_Shadow>(); FillBaseData(shadowEffect, reader, row); shadowEffect.nStartTick = reader.GetInt(row, (int)Column_Shadow.COL_STARTTICK, 0); shadowEffect.nEndTick = reader.GetInt(row, (int)Column_Shadow.COL_ENDTICK, 0); shadowEffect.fStartAlpha = reader.GetFloat(row, (int)Column_Shadow.COL_STARTALPHA, 0); shadowEffect.nShadowMaintainTick = reader.GetInt(row, (int)Column_Shadow.COL_MAINTAINTICK, 0); shadowEffect.nShadowFadeoutTick = reader.GetInt(row, (int)Column_Shadow.COL_FADEOUTTICK, 0); shadowEffect.shadowIntervalTicks = reader.GetInt(row, (int)Column_Shadow.COL_INTERVTICK, 0); string[] frameStrArry = reader.GetString(row, (int)Column_Shadow.COL_FRAMETICK, "").Split(';'); int[] frameIntArry = new int[frameStrArry.Length]; for (int i = 0; i < frameStrArry.Length; i++) { int.TryParse(frameStrArry[i], out frameIntArry[i]); } shadowEffect.shadowFrameTicks = frameIntArry; shadowEffect.alphaAttributeName = reader.GetString(row, (int)Column_Shadow.COL_ALPHAATTNAME, ""); shadowEffect.DisableWeapon = reader.GetInt(row, (int)Column_Shadow.COL_DISABLEWEAPON, 0) > 0 ? true : false; int attrType = reader.GetInt(row, (int)Column_Shadow.COL_ALPHAATTTYPE, 0); if (Enum.IsDefined(typeof(LightingEffect_Shadow.AlphaAttributeType), attrType)) { shadowEffect.alphaAttributeType = (LightingEffect_Shadow.AlphaAttributeType)attrType; } shadowEffect.minDistance = reader.GetFloat(row, (int)Column_Shadow.COL_MINDISTANCE, 0); AddLightEffect(shadowEffect); } break; case (int)LightingEffectConfigType.Sound: { LightingEffect_Sound soundEffect = ScriptableObject.CreateInstance <LightingEffect_Sound>(); FillBaseData(soundEffect, reader, row); soundEffect.soundID = reader.GetInt(row, (int)Column_Sound.COL_SOUND, 0); AddLightEffect(soundEffect); } break; case (int)LightingEffectConfigType.Speed: { LightingEffect_Speed speedEffect = ScriptableObject.CreateInstance <LightingEffect_Speed>(); FillBaseData(speedEffect, reader, row); speedEffect.nStartTick = reader.GetInt(row, (int)Column_Speed.COL_STARTTICK, 0); speedEffect.nEndTick = reader.GetInt(row, (int)Column_Speed.COL_ENDTICK, 0); speedEffect.globalSpeed = reader.GetFloat(row, (int)Column_Speed.COL_GLOBALSPEED, 0); speedEffect.animatorSpeed = reader.GetFloat(row, (int)Column_Speed.COL_ANIMSPEED, 0); speedEffect.effectRad = reader.GetFloat(row, (int)Column_Speed.COL_EFFECTRAD, 0); AddLightEffect(speedEffect); } break; case (int)LightingEffectConfigType.Ward: { LightingEffect_Ward wardEffect = ScriptableObject.CreateInstance <LightingEffect_Ward>(); FillBaseData(wardEffect, reader, row); wardEffect.nStartTick = reader.GetInt(row, (int)Column_Ward.COL_STARTTICK, 0); wardEffect.nEndTick = reader.GetInt(row, (int)Column_Ward.COL_ENDTICK, 0); wardEffect.blockAllCreature = reader.GetInt(row, (int)Column_Ward.COL_BLOCKALLCREATURE, 0) > 0 ? true : false; AddLightEffect(wardEffect); } break; case (int)LightingEffectConfigType.Invalid: default: break; } }