public void Update() { if (m_refreshFov) { m_cameraCfgIndex = (m_cameraCfgIndex + 1) % m_cameraConfigs.Length; if (m_cameraConfigs[m_cameraCfgIndex].IsOrtho) { MainGame.Singleton.MainCamera.MainCamera.GetComponent <Camera>().orthographic = true; MainGame.Singleton.MainCamera.MainCamera.GetComponent <Camera>().orthographicSize = 2.5f; } else { MainGame.Singleton.MainCamera.MainCamera.GetComponent <Camera>().orthographic = false; MainGame.Singleton.MainCamera.MainCamera.GetComponent <Camera>().fieldOfView = CameraFieldOfView; //MainGame.Singleton.MainCamera.MainCamera.camera.orthographic = false; } m_refreshFov = false; } if (m_testShader) { m_testShader = false; Actor target = ActorManager.Singleton.MainActor; AnimationShaderParamCallback callback = target.GetBodyParentObject().GetComponent <AnimationShaderParamCallback>(); callback.ChangeShader("shader_beAttacked"); } }
//根据服务器发回的数据进行结算 public override void ResultServerExec(IResultControl control) { SkillResultInfo info = GameTable.SkillResultTableAsset.Lookup(SkillResultID); if (null == info) { return; } Actor target = ActorManager.Singleton.Lookup(TargetID); Actor source = ActorManager.Singleton.Lookup(SourceID); if (null == target || source == null) { return; } //没有命中 if (!m_isHit) { return; } // 如果产生combo if (info.ComboNum > 0) { //m_damageModify = GetComboSkillDamageModify(SkillResultID); source.OnComboChanged(SkillResultID, TargetID, m_damageModify); } //目标强韧 { target.OnStaminaEvent(source, out m_isFly); } if (m_isBreak || m_isFly) { target.BeHited(source, m_isBack, m_isFly, info.AnimGauge); } else if (m_isFakeBreak) { target.FakeBeHited(source); } if (info.IsPlayEffect) { target.PlayEffect(info.EffectName, info.EffectDuration, info.EffectPos, info.IsAheadBone, Vector3.zero); } if (info.IsChangeShader) { AnimationShaderParamCallback callback = target.GetBodyParentObject().GetComponent <AnimationShaderParamCallback>(); callback.ChangeShader(info.ChangeShaderAnimName); } //战斗意志 source.OnAddWill(WillToFight.ENAddWillType.enSkillResult, new float[2] { info.SFightWillGet, info.NFightWillGet }); // 设置爆破点 target.SetBlastPos(source.RealPos, source.GetBodyObject().transform.forward); }
public void CameraFieldOfView(AnimationEvent animEvent) { if (m_mineObj == null) { return; } AnimationShaderParamCallback shader = m_mineObj.GetComponent <AnimationShaderParamCallback>(); if (null == shader) { return; } shader.CameraFieldOfView(animEvent); }
public void TimeScale(AnimationEvent animEvent) { if (m_mineObj == null) { return; } AnimationShaderParamCallback shader = m_mineObj.GetComponent <AnimationShaderParamCallback>(); if (null == shader) { return; } shader.TimeScale(animEvent); }
public void EffectInTarget(AnimationEvent animEvent) { if (m_mineObj == null) { return; } AnimationShaderParamCallback shader = m_mineObj.GetComponent <AnimationShaderParamCallback>(); if (null == shader) { return; } shader.EffectInTarget(animEvent); }
public override void Exec(IResultControl control) { SkillResultInfo info = GameTable.SkillResultTableAsset.Lookup(SkillResultID); if (null == info) { return; } Actor target = ActorManager.Singleton.Lookup(TargetID); Actor source = ActorManager.Singleton.Lookup(SourceID); if (null != target && source != null) { float r = UnityEngine.Random.Range(0.0f, 1.0f); if (r >= source.Props.GetProperty_Float(ENProperty.hit) - target.Props.GetProperty_Float(ENProperty.avoid)) {//没有命中 return; } r = UnityEngine.Random.Range(0.0f, 1.0f); bool isFakeBreak = false, isBreak = false, isBack = false, isFly = false; if (r <= info.InterferePersent - target.Props.GetProperty_Float(ENProperty.AnitInterfere)) {//普通受击 isFakeBreak = true; r = UnityEngine.Random.Range(0.0f, 1.0f); if (r < info.BreakPersent - target.Props.GetProperty_Float(ENProperty.AnitInterrupt)) {//强受击 isBreak = true; //Debug.LogWarning("hit 打断 target id=" + target.ID.ToString()); r = UnityEngine.Random.Range(0.0f, 1.0f); if (r <= info.HitBackPersent - target.Props.GetProperty_Float(ENProperty.AnitRepel)) {//击退 //Debug.LogWarning("hit 击退 target id=" + target.ID.ToString()); isBack = true; r = UnityEngine.Random.Range(0.0f, 1.0f); if (r < info.HitFlyPersent - target.Props.GetProperty_Float(ENProperty.AnitLauncher)) {//击飞 //Debug.LogWarning("hit 击飞 target id=" + target.ID.ToString()); isFly = true; } } } } if (info.ComboNum > 0) { m_damageModify = GetComboSkillDamageModify(SkillResultID); source.OnComboChanged(SkillResultID, TargetID, m_damageModify); } {//目标强韧结算 float curStamina = target.Props.GetProperty_Float(ENProperty.stamina); if (curStamina <= 0.0f) { target.OnStaminaEvent(source, out isFly); isBack = isFly ? isFly : isBack; } } if (isBreak || isFly) { target.BeHited(source, isBack, isFly, info.AnimGauge); } else if (isFakeBreak) { target.FakeBeHited(source); } } else { return; } if (info.IsPlayEffect) { target.PlayEffect(info.EffectName, info.EffectDuration, info.EffectPos, info.IsAheadBone, Vector3.zero); } if (info.IsChangeShader) { AnimationShaderParamCallback callback = target.GetBodyParentObject().GetComponent <AnimationShaderParamCallback>(); callback.ChangeShader(info.ChangeShaderAnimName); } foreach (var item in info.ParamList) { if (item.ID == (int)ENResult.Skill) { BattleFactory.Singleton.CreateSkillResult(SourceID, (int)item.Param[0], target.ID, SkillID, item.Param); continue; } IResult r = BattleFactory.Singleton.CreateResult((ENResult)item.ID, SourceID, TargetID, SkillResultID, SkillID, item.Param); if (r != null) { if (item.ID == (int)ENResult.Damage) { ResultDamage damage = r as ResultDamage; damage.DamageModify = m_damageModify / 100 + 1; } r.ResultExpr(item.Param); BattleFactory.Singleton.DispatchResult(r); } } if (source.Combo != null) {//combo附加效果 int comboResultID = 0; foreach (var item in info.ExtraParamList) { if (item.ComboJudgeCount <= 0) { continue; } int comboValue = source.Combo.TotalComboNumber; if (comboValue >= item.ComboJudgeCount) { comboResultID = item.SkillResultID; } } if (comboResultID != 0) { BattleFactory.Singleton.CreateSkillResult(SourceID, comboResultID, target.ID, SkillID); } } //战斗意志 source.OnAddWill(WillToFight.ENAddWillType.enSkillResult, new float[2] { info.SFightWillGet, info.NFightWillGet }); }
//所有buff结算 private void BuffResult() { float MultiplyFHPMax = 0.0f, MultiplyFPhyAttack = 0.0f, MultiplyFMagAttack = 0.0f, MultiplyFPhyDefend = 0.0f, MultiplyFMagDefend = 0.0f, MultiplyFavoid = 0.0f, MultiplyFhit = 0.0f, MultiplyFcrit = 0.0f, MultiplyFcritparam = 0.0f, MultiplyFResist = 0.0f, MultiplyMoveSpeed = 0.0f, MultiplyAnitInterfereRate = 0, MultiplyAnitInterruptRate = 0, MultiplyAnitRepelRate = 0, MultiplyAnitLauncherRate = 0, MultiplyWoundParam = 0, MultiplyMovebackSpeed = 0, MultiplyAnimationSpeed = 0, MultiplyAttackAnimSpeed = 0, MultiplySkillCD = 0, AddFHPMax = 0, AddFPhyAttack = 0, AddFMagAttack = 0, AddFPhyDefend = 0, AddFMagDefend = 0, AddFavoid = 0, AddFhit = 0, AddFcrit = 0, AddFcritparam = 0, AddFResist = 0, AddMoveSpeed = 0, AddAnitInterfere = 0, AddAnitInterrupt = 0, AddAnitRepel = 0, AddAnitLauncher = 0, AddWoundParam = 0, AddMovebackSpeed = 0, AddAnimationSpeed = 0, AddAttackAnimSpeed = 0, AddSkillCD = 0; int buffEffectID = 0, buffEffectLevel = 0; if (m_buffIdForShader != 0 && null == BuffList.Find(item => item.BuffID == m_buffIdForShader)) { AnimationShaderParamCallback callback = m_target.GetBodyParentObject().GetComponent <AnimationShaderParamCallback>(); if (callback != null) { //恢复shader的color callback.RestoreShader(m_colorNameForShader, AnimationShaderParamCallback.ENParamType.enColor); } else { Debug.LogWarning("BuffControl BuffResult change shader, AnimationShaderParamCallback is null"); } } foreach (var item in BuffList) { if (null != item && !item.IsNeedRemove && item.IsCalcProperty) { BuffInfo info = GameTable.BuffTableAsset.Lookup(item.BuffID); if (null != info) { int index = 0; MultiplyFHPMax += info.PropertyPercentList[index++]; MultiplyFPhyAttack += info.PropertyPercentList[index++]; MultiplyFMagAttack += info.PropertyPercentList[index++]; MultiplyFPhyDefend += info.PropertyPercentList[index++]; MultiplyFMagDefend += info.PropertyPercentList[index++]; MultiplyFavoid += info.PropertyPercentList[index++]; MultiplyFhit += info.PropertyPercentList[index++]; MultiplyFcrit += info.PropertyPercentList[index++]; MultiplyFcritparam += info.PropertyPercentList[index++]; MultiplyFResist += info.PropertyPercentList[index++]; MultiplyAnitInterfereRate += info.PropertyPercentList[index++]; MultiplyAnitInterruptRate += info.PropertyPercentList[index++]; MultiplyAnitRepelRate += info.PropertyPercentList[index++]; MultiplyAnitLauncherRate += info.PropertyPercentList[index++]; MultiplyMoveSpeed += info.PropertyPercentList[index++]; MultiplyWoundParam += info.PropertyPercentList[index++]; MultiplyAnimationSpeed += info.PropertyPercentList[index++]; MultiplyMovebackSpeed += info.PropertyPercentList[index++]; MultiplyAttackAnimSpeed += info.PropertyPercentList[index++]; MultiplySkillCD += info.PropertyPercentList[index++]; index = 0; AddFHPMax += info.PropertyValueList[index++]; AddFPhyAttack += info.PropertyValueList[index++]; AddFMagAttack += info.PropertyValueList[index++]; AddFPhyDefend += info.PropertyValueList[index++]; AddFMagDefend += info.PropertyValueList[index++]; AddFavoid += info.PropertyValueList[index++]; AddFhit += info.PropertyValueList[index++]; AddFcrit += info.PropertyValueList[index++]; AddFcritparam += info.PropertyValueList[index++]; AddFResist += info.PropertyValueList[index++]; AddAnitInterfere += info.PropertyValueList[index++]; AddAnitInterrupt += info.PropertyValueList[index++]; AddAnitRepel += info.PropertyValueList[index++]; AddAnitLauncher += info.PropertyValueList[index++]; AddMoveSpeed += info.PropertyValueList[index++]; AddWoundParam += info.PropertyValueList[index++]; AddAnimationSpeed += info.PropertyValueList[index++]; AddMovebackSpeed += info.PropertyValueList[index++]; AddAttackAnimSpeed += info.PropertyValueList[index++]; AddSkillCD += info.PropertyValueList[index++]; BuffEffectInfo buffEInfo = GameTable.BuffEffectTableAsset.Lookup(info.BuffEffectID); if (buffEInfo != null) { if (buffEInfo.EffectLevel >= buffEffectLevel) { buffEffectLevel = buffEInfo.EffectLevel; buffEffectID = info.BuffEffectID; m_buffIdForShader = info.ID; } } } } } CalcFloat(Props.phyAttack, MultiplyFPhyAttack, AddFPhyAttack, ENProperty.phyattack); CalcFloat(Props.magAttack, MultiplyFMagAttack, AddFMagAttack, ENProperty.magattack); CalcFloat(Props.phyDefend, MultiplyFPhyDefend, AddFPhyDefend, ENProperty.phydefend); CalcFloat(Props.magDefend, MultiplyFMagDefend, AddFMagDefend, ENProperty.magdefend); CalcFloat(Props.hpMax, MultiplyFHPMax, AddFHPMax, ENProperty.maxhp); CalcFloat(Props.avoid, MultiplyFavoid, AddFavoid, ENProperty.avoid); CalcFloat(Props.hit, MultiplyFhit, AddFhit, ENProperty.hit); CalcFloat(Props.crit, MultiplyFcrit, AddFcrit, ENProperty.crit); CalcFloat(Props.critparam, MultiplyFcritparam, AddFcritparam, ENProperty.critParam); CalcFloat(Props.FResist, MultiplyFResist, AddFResist, ENProperty.FResist); CalcFloat(Props.moveSpeed, MultiplyMoveSpeed, AddMoveSpeed, ENProperty.runSpeed); CalcFloat(Props.AnitInterfere, MultiplyAnitInterfereRate, AddAnitInterfere, ENProperty.AnitInterfere); CalcFloat(Props.AnitInterrupt, MultiplyAnitInterruptRate, AddAnitInterrupt, ENProperty.AnitInterrupt); CalcFloat(Props.AnitRepel, MultiplyAnitRepelRate, AddAnitRepel, ENProperty.AnitRepel); CalcFloat(Props.AnitLauncher, MultiplyAnitLauncherRate, AddAnitLauncher, ENProperty.AnitLauncher); CalcFloat(Props.WoundParam, MultiplyWoundParam, AddWoundParam, ENProperty.WoundParam); CalcFloat(Props.movebackSpeed, MultiplyMovebackSpeed, AddMovebackSpeed, ENProperty.MovebackSpeed); float animSpeed = m_target.AnimationSpeed; CalcFloat(Props.animationSpeed, MultiplyAnimationSpeed, AddAnimationSpeed, ENProperty.AnimationSpeed); float attackAnimSpeed = m_target.AttackAnimSpeed; CalcFloat(Props.attackAnimSpeed, MultiplyAttackAnimSpeed, AddAttackAnimSpeed, ENProperty.AttackAnimSpeed); if (animSpeed != m_target.AnimationSpeed || attackAnimSpeed != m_target.AttackAnimSpeed) {//anim速度改变 m_target.AnimationSpeedChanged(); } m_target.SkillCDModifyValue = AddSkillCD; m_target.SkillCDModifyPercent = MultiplySkillCD; BuffEffectInfo beInfo = GameTable.BuffEffectTableAsset.Lookup(buffEffectID); if (beInfo != null) { if (beInfo.IsChangeShaderColor) { AnimationShaderParamCallback callback = m_target.GetBodyParentObject().GetComponent <AnimationShaderParamCallback>(); if (callback != null) { //改变shader的color callback.ChangeShaderColor(beInfo.ShaderColorName, beInfo.ShaderColorParam); m_colorNameForShader = beInfo.ShaderColorName; } else { Debug.LogWarning("BuffControl BuffResult change shader, AnimationShaderParamCallback is null"); } } else { m_buffIdForShader = 0; } } m_target.NotifyChangeModel(); }
void RefreshBuffGraphics() { int buffEffectID = 0, buffEffectLevel = 0; if (m_buffIdForShader != 0 && null == BuffList.Find(item => item.BuffID == m_buffIdForShader)) { AnimationShaderParamCallback callback = m_target.GetBodyParentObject().GetComponent <AnimationShaderParamCallback>(); if (callback != null) { //恢复shader的color callback.RestoreShader(m_colorNameForShader, AnimationShaderParamCallback.ENParamType.enColor); } else { Debug.LogWarning("BuffControl BuffResult change shader, AnimationShaderParamCallback is null"); } } foreach (var item in BuffList) { if (null != item && !item.IsNeedRemove) { BuffInfo info = GameTable.BuffTableAsset.Lookup(item.BuffID); if (null != info) { BuffEffectInfo buffEInfo = GameTable.BuffEffectTableAsset.Lookup(info.BuffEffectID); if (buffEInfo != null) { if (buffEInfo.EffectLevel >= buffEffectLevel) { buffEffectLevel = buffEInfo.EffectLevel; buffEffectID = info.BuffEffectID; m_buffIdForShader = info.ID; } } } } } BuffEffectInfo beInfo = GameTable.BuffEffectTableAsset.Lookup(buffEffectID); if (beInfo != null) { if (beInfo.IsChangeShaderColor) { AnimationShaderParamCallback callback = m_target.GetBodyParentObject().GetComponent <AnimationShaderParamCallback>(); if (callback != null) { //改变shader的color callback.ChangeShaderColor(beInfo.ShaderColorName, beInfo.ShaderColorParam); m_colorNameForShader = beInfo.ShaderColorName; } else { Debug.LogWarning("BuffControl BuffResult change shader, AnimationShaderParamCallback is null"); } } else { m_buffIdForShader = 0; } } m_target.NotifyChangeModel(); }