/// <summary> /// 创建开始,循环阶段特效 /// </summary> private void CreateStartFXAndLoopFX() { if (VO.Link_id > 0 && !VO.Is_master) { //连线 buff, 被链接方,不播特效 return; } SkillBuff buffConfig = m_SkillProxy.GetBuff((int)VO.ID); CfgSkillSystemProxy skillProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgSkillSystemProxy) as CfgSkillSystemProxy; if (Leyoutech.Utility.EffectUtility.IsEffectNameValid(buffConfig.StartFx)) { EffectController StartFX = EffectManager.GetInstance().CreateEffect(buffConfig.StartFx, EffectManager.GetEffectGroupNameInSpace(BuffProperty.IsMain())); //StartFX.transform.SetParent(BuffEffect.m_SelfTransform, false); BuffEffect.SetStartEffectController(StartFX); StartFX.SetCreateForMainPlayer(BuffProperty.IsMain()); } if (Leyoutech.Utility.EffectUtility.IsEffectNameValid(buffConfig.LoopFx)) { EffectController LoopFX = EffectManager.GetInstance().CreateEffect(buffConfig.LoopFx, EffectManager.GetEffectGroupNameInSpace(BuffProperty.IsMain()), OnCreateStartAndLoopFX, this); //LoopFX.transform.SetParent(BuffEffect.m_SelfTransform, false); BuffEffect.SetLoopEffectController(LoopFX); LoopFX.SetCreateForMainPlayer(BuffProperty.IsMain()); } }
void buffProcess(SkillBuff n) { if (n.target == SkillTarget.Target.Area) { Matrix4x4 mt = Matrix4x4.TRS(mUnit.pos, Quaternion.LookRotation(mUnit.dir), Vector3.one).inverse; List <Unit> units = mUnit.mgr.getUnitInArea(UnitType.Monster | UnitType.Player, n.area, mt); for (int i = 0; i < units.Count; ++i) { Unit u = units [i]; if (!mUnit.isRelation(u, (int)n.relation)) { continue; } u.buff.addBuff(n.id); } } else { if ((n.relation & UnitRelation.Self) != 0) { mUnit.buff.addBuff(n.id); } Unit u = mUnit.skill.targetUnit; if (u != null && mUnit.isRelation(u, (int)n.relation)) { u.buff.addBuff(n.id); } } }
public void SetBuffActive(CharacterState target, int effectPos) { if (target.Invisible && target.groupIndex == 0) { return; } List <SkillBuff> buffs = SkillBuffManager.GetInst().GetSkillBuffListByCs(target); buffs.Sort(SortSkillBuff); SkillBuff mExitBuff = buffs.Find(a => a.node.effectPos == effectPos && a.buffGo != null && a.buffGo.gameObject.activeSelf); SkillBuff mCurBuff = buffs.Find(a => a.node.effectPos == effectPos && a.buffGo != null && !a.buffGo.gameObject.activeSelf); if (mExitBuff != null) { if (mCurBuff != null) { if (buffs.IndexOf(mCurBuff) > buffs.IndexOf(mExitBuff) && mCurBuff.id != mExitBuff.id) { mExitBuff.buffGo.gameObject.SetActive(false); mCurBuff.buffGo.gameObject.SetActive(true); } } } else { if (mCurBuff != null) { mCurBuff.buffGo.gameObject.SetActive(true); } } }
public SkillBuff AddBuffTo(SkillBuff sBuff, CharacterState cs, CharacterState attackerCS, SkillNode skillNode, int lvl, bool needCheck) { List <CharacterState> keys = new List <CharacterState>(CharBuffs.Keys); for (int i = keys.Count - 1; i >= 0; i--) { if (keys [i] == null) { CharBuffs.Remove(keys[i]); } } if (CheckCanAdd(sBuff, cs, attackerCS) || !needCheck) { if (CharBuffs.ContainsKey(cs)) { CharBuffs[cs].Add(sBuff); } else { List <SkillBuff> buffs = new List <SkillBuff>(); buffs.Add(sBuff); CharBuffs.Add(cs, buffs); } sBuff.target = cs; sBuff.attacker = attackerCS; sBuff.SetBuffSkillNode(skillNode, lvl); sBuff.showHud = GameLibrary.Instance().ShouldShowHud(cs, attackerCS); sBuff.Init(); AddCalculateCurTargetProp(cs, sBuff); //sBuff.Excute(cs); cs.OnDead += (CharacterState mcs) => RemoveCalculateCurTargetProp(mcs, sBuff); return(sBuff); } return(null); }
public List <SkillBuff> AddSpecialBuffs(CharacterState cs) { List <SkillBuff> mSpecialBuffs = new List <SkillBuff>(); for (int i = 0; i < specialBuffs.Length; i++) { if (specialBuffs[i] is Array) { Array o = (Array)specialBuffs[i]; if (o != null && o.Length == 3) { object a = o.GetValue(0); long mBuffId = long.Parse(a.ToString()); if ((SkillBuffType)mBuffId == SkillBuffType.Summon) { continue; } float mBuffValue = float.Parse(o.GetValue(2).ToString()); SkillBuff mTempBuff = SkillBuffManager.GetInst().AddBuffs(mBuffValue, new object[2] { a, o.GetValue(1) }, cs, cs, this, cs.CharData.lvl, false); mSpecialBuffs.Add(mTempBuff); } } } return(mSpecialBuffs); }
public void RemoveCalculateCurTargetProp(CharacterState cs, SkillBuff sBuff) { if (cs != null && CharBuffs.ContainsKey(cs) && CharBuffs[cs].Contains(sBuff)) { float resultValue = 0; //查找和当前buff同类型的 List <SkillBuff> mCurSkillBuff = CharBuffs[cs].FindAll(a => a != sBuff && a.node.type == sBuff.node.type && a.node.buffActionType == sBuff.node.buffActionType); //增益减益的不存在取当前值,存在取差值,其它的只有最后一个buff存在的值才为0 if ((sBuff.node.type == BuffType.increase || sBuff.node.type == BuffType.decrease) && (SkillBuffType)sBuff.id != SkillBuffType.AbsorbDamage) { if (mCurSkillBuff.Count > 0) { mCurSkillBuff.Sort((a, b) => Mathf.FloorToInt(b.baseValue - a.baseValue)); if (sBuff.baseValue > mCurSkillBuff[0].baseValue) { resultValue = sBuff.baseValue - mCurSkillBuff[0].baseValue; } } else { resultValue = sBuff.baseValue; } } else { resultValue = mCurSkillBuff.Count; } sBuff.Reverse(cs, resultValue); } }
public GameObject AddAttackEffect(string id, GameObject target, SkillNode skillNode, Transform emissionPoint = null) { string idIndex = id; if (skillNode != null && skillNode.site == 0 && (cs.mCurMobalId == MobaObjectID.HeroXiaohei || cs.mCurMobalId == MobaObjectID.HeroChenmo)) { SkillBuff buff = SkillBuffManager.GetInst().GetSkillBuffListByCs(cs).Find (a => (SkillBuffType)a.id == SkillBuffType.Talent && a.attacker == cs); if (buff != null) { idIndex += "_1"; } } else if (skillNode != null && skillNode.site == 1 && cs.mCurMobalId == MobaObjectID.HeroLuosa) { SkillBuff buff = SkillBuffManager.GetInst().GetSkillBuffListByCs(cs).Find (a => (SkillBuffType)a.id == SkillBuffType.SkillTalent && a.attacker == cs); idIndex += buff != null ? "_2_1" : "_1_1"; } GameObject effect_go = BattleUtil.AddEffectTo(GetEffectResourceRoot() + idIndex, transform, id, skillNode, cs); if (effect_go != null) { effect_go.transform.parent = nip.transform; if (emissionPoint != null) { effect_go.transform.position = emissionPoint.position; } } return(effect_go); }
public Buff(BuffVO vo, IBuffProperty property) { VO = vo; BuffProperty = property; // Cache m_SkillProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgSkillSystemProxy) as CfgSkillSystemProxy; m_GameplayProxy = GameFacade.Instance.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy; Leyoutech.Utility.DebugUtility.LogWarning("Buff", string.Format("创建一个Buff ---> 归属entity = {0} , Buff ID = {1}", BuffProperty.EntityId(), VO.ID)); SkillBuff configVO = m_SkillProxy.GetBuff((int)VO.ID); if (configVO.ByteBuffer != null) { BuffEffect = BuffEffectBase.GetBuffEffectByType((BuffEffectType)configVO.BuffEffectId, this); Transform selfTf = BuffProperty.GetRootTransform(); SpacecraftEntity otherEntity = m_GameplayProxy.GetEntityById <SpacecraftEntity>(VO.Link_id) as SpacecraftEntity; Transform otherTf = null; if (otherEntity != null && !otherEntity.IsDead()) { otherTf = otherEntity.GetRootTransform(); } BuffEffect.Init(selfTf, otherTf); } else { BuffEffect = new BuffEffectBase(this); } }
bool CheckCanAdd(SkillBuff sBuff, CharacterState cs, CharacterState attackerCS) { if (attackerCS == null) { return(cs.RecieveControl); } if (attackerCS.groupIndex != cs.groupIndex) { if (cs.RecieveControl) { if (GameLibrary.Instance().CheckNotHeroBoss(cs)) { return((sBuff.node.type == BuffType.decrease || sBuff.node.type == BuffType.continuousDecrease || sBuff.node.type == BuffType.DelayEffective) && sBuff.id != (long)SkillBuffType.Slow); } else { return(sBuff.node.type == BuffType.control || sBuff.node.type == BuffType.decrease || sBuff.node.type == BuffType.translate || sBuff.node.type == BuffType.continuousDecrease || sBuff.node.type == BuffType.DelayEffective); } } else { return(false); } } else { return(sBuff.node.type == BuffType.increase || sBuff.node.type == BuffType.immune || sBuff.node.type == BuffType.other || sBuff.node.type == BuffType.continuousIncrease || sBuff.node.type == BuffType.talent || sBuff.node.type == BuffType.Summon); } }
protected override void takeAction(SkillEffect effect) { SkillBuff buff = effect as SkillBuff; if (buff != null && buff.IsMutuallyExclusive(mMutex)) { effect.Stop(StopReason); } }
protected override void takeAction(SkillEffect effect) { SkillBuff buff = effect as SkillBuff; if (buff != null && buff.HasStunEffect) { effect.Stop(StopReason); } }
protected override void takeAction(SkillEffect effect) { SkillBuff buff = effect as SkillBuff; if (buff != null && buff.SameGroup(mGroupID)) { buff.Stop(StopReason); } }
public int GetEffect() { SkillBuff configVO = m_SkillProxy.GetBuff((int)VO.ID); if (configVO.ByteBuffer != null) { return(configVO.PropEffect); } return(0); }
public void RemoveBuffFrom(SkillBuff sBuff, CharacterState cs) { if (CharBuffs.ContainsKey(cs)) { if (CharBuffs[cs].Contains(sBuff)) { CharBuffs[cs].Remove(sBuff); } } }
private int SortSkillBuff(SkillBuff a, SkillBuff b) { if (a.node.priorityBuff == b.node.priorityBuff) { return(b.node.priorityShow - a.node.priorityShow); } else { return(b.node.priorityBuff - a.node.priorityShow); } }
private void SetSkillBtnCD(bool b) { if (!b) { mExistBuff = SkillBuffManager.GetInst().GetSkillBuffListByCs(target).Find(a => a != this && (SkillBuffType)a.id == SkillBuffType.Silence); } if (target == CharacterManager.playerCS) { mFightTouch.ChangeAllCDTo(b ? b : !(mExistBuff == null && GameLibrary.Instance().CanControlSwitch(target.pm))); } }
public override void Reverse(CharacterState cs, float mCurValue) { base.Reverse(cs, mCurValue); SkillBuff mPetrifiedBuff = SkillBuffManager.GetInst().GetSkillBuffListByCs(target).Find(a => a != this && a.id == id); if (mPetrifiedBuff == null) { SetSkinedPetrified(false); cs.pm.ani.speed = cs.animSpeed; } }
public void CheckBuffPlaySound(uint buffId, bool isOpen) { CfgSkillSystemProxy skillProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgSkillSystemProxy) as CfgSkillSystemProxy; SkillBuff configVO = skillProxy.GetBuff((int)buffId); if (isOpen && configVO.SoundAppearance > 0) { WwiseUtil.PlaySound(configVO.SoundAppearance, false, null); } else if (!isOpen && configVO.SoundEnd > 0) { WwiseUtil.PlaySound(configVO.SoundEnd, false, null); } }
public void RemoveContinousSkillBuff(SkillBuff tempBuff) { if (tempBuff.node.type == BuffType.continuousDecrease || tempBuff.node.type == BuffType.continuousIncrease) { if (tempBuff.node.type == BuffType.continuousDecrease) { CDTimer.GetInstance().RemoveCD((tempBuff as BF_Bleeding).bleedCd); } else { CDTimer.GetInstance().RemoveCD((tempBuff as BF_Restore).restoreCd); } } }
public object OnClearBuff(params object[] objs) { foreach (ushort k in buffs.Keys) { SkillBuff buff = buffs[k]; foreach (GameObject obj in buff.buffs) { obj.AddComponent <DestoryObject>(); } } Owner.property.lockOpera = false; buffs.Clear(); return(null); }
public List <SkillBuff> GetAllDebuffByCs(CharacterState cs) { List <SkillBuff> resultList = new List <SkillBuff>(); List <SkillBuff> tempList = GetSkillBuffListByCs(cs); for (int i = 0; i < tempList.Count; i++) { SkillBuff tempBuff = tempList[i]; if (tempBuff.node.type == BuffType.control || tempBuff.node.type == BuffType.decrease || tempBuff.node.type == BuffType.continuousDecrease || tempBuff.node.type == BuffType.DelayEffective) { resultList.Add(tempBuff); } } return(resultList); }
public static SkillNode createNode(Type nodeType) { SkillNode n = null; switch (nodeType) { case SkillNode.Type.Action: n = new SkillAction(); break; case SkillNode.Type.Anim: n = new SkillAnim(); break; case SkillNode.Type.Harm: n = new SkillHarm(); break; case SkillNode.Type.Bullet: n = new SkillBullet(); break; case SkillNode.Type.Buff: n = new SkillBuff(); break; case SkillNode.Type.Event: n = new SkillEvent(); break; case SkillNode.Type.Move: n = new SkillMove(); break; case SkillNode.Type.Lua: n = new SkillLua(); break; default: Debug.LogError("unsurpport skillnode type:" + nodeType); return(null); } return(n); }
public object OnAddBuff(params object[] objs) { ushort wBuffID = Convert.ToUInt16(objs[0]); InitBuff(wBuffID); BuffInfor infor; FxAsset assert; OnRemoveBuff(wBuffID); if (globalBuffsTemps.TryGetValue(wBuffID, out infor)) { if (infor.infor.AttributeKey1.CompareTo("atForbitMove") == 0) { Owner.property.lockOpera = true; } assert = infor.assert; int len = infor.bindPoints.Length; SkillBuff buff = new SkillBuff(); buffs[wBuffID] = buff; buff.wBuffID = wBuffID; buff.infor = infor.infor; buff.buffs = new GameObject[len]; for (int i = 0; i < len; i++) { GameObject g = assert.CloneAndAddToParent(Owner.transform, Vector3.up * 1.5f); if (null == g) { return(null); } buff.buffs[i] = g; ObjectUtil.SetTagWithAllChildren(g, CameraLayerManager.GetInstance().GetMissionSignName()); Transform t = Owner.GetChildTransform(infor.bindPoints[i]); if (null != t) { g.transform.parent = t; } g.transform.localPosition = Vector3.zero; g.transform.localScale = Vector3.one; } } return(null); }
private void RemoveBuffFXAndCreateEndFX() { if (VO.Link_id > 0 && !VO.Is_master) { //连线 buff, 被链接方,不播特效 return; } // 创建结束特效 SkillBuff buffVO = m_SkillProxy.GetBuff((int)VO.ID); if (Leyoutech.Utility.EffectUtility.IsEffectNameValid(buffVO.EndFX)) { EffectController EndFX = EffectManager.GetInstance().CreateEffect(buffVO.EndFX, EffectManager.GetEffectGroupNameInSpace(BuffProperty.IsMain())); //EndFX.transform.SetParent(BuffEffect.m_SelfTransform, false); BuffEffect.SetEndEffectController(EndFX); EndFX.SetCreateForMainPlayer(BuffProperty.IsMain()); } }
public void SetControlSwitch(bool b) { if (b) { canControlSwitch++; } else { canControlSwitch--; } if (cs == CharacterManager.playerCS) { SkillBuff mExistBuff = null; if (!b) { mExistBuff = SkillBuffManager.GetInst().GetSkillBuffListByCs(cs).Find(a => (SkillBuffType)a.id == SkillBuffType.Silence); } FightTouch._instance.ChangeAllCDTo(b ? b: !(mExistBuff == null && GameLibrary.Instance().CanControlSwitch(this))); } }
public override void Excute(CharacterState cs, float mCurValue) { base.Excute(cs, mCurValue); //查询所有的减益效果 List <SkillBuff> mAllDebuff = SkillBuffManager.GetInst().GetAllDebuffByCs(cs); for (int i = mAllDebuff.Count - 1; i >= 0; i--) { SkillBuff mTempBuff = mAllDebuff[i]; if (mTempBuff.node.type == BuffType.DelayEffective) { SkillBuffManager.GetInst().RemoveBuffFrom(mTempBuff, mTempBuff.target); mTempBuff.RemoveBuffEffect(); } else { SkillBuffManager.GetInst().RemoveCalculateCurTargetProp(mTempBuff.target, mTempBuff); } SkillBuffManager.GetInst().RemoveContinousSkillBuff(mTempBuff); } }
public static SkillEffect AllocSkillEffect(SkillEffectInitParam param) { System.Type paramType = param.GetType(); SkillEffect result = null; if (paramType == typeof(SkillBuffInitParam)) { result = new SkillBuff(); } else if (paramType == typeof(SkillImpactInitParam)) { result = new SkillImpact(); } // else if branch. else { ErrorHandler.Parse(ErrorCode.LogicError, "allocate skill effect failed: invalid skilleffect type"); } return(result); }
public object OnRemoveBuff(params object[] objs) { ushort wBuffID = Convert.ToUInt16(objs[0]); OnRemoveBuff(wBuffID); Dictionary <ushort, BuffInfor> globalBuffsTemps = new Dictionary <ushort, BuffInfor>(); if (Owner.property.lockOpera) { Owner.property.lockOpera = false; foreach (KeyValuePair <ushort, SkillBuff> kvp in buffs) { SkillBuff sb = kvp.Value; if (sb.infor.AttributeKey1.IndexOf("atForbitMove") == 0) { Owner.property.lockOpera = true; break; } } } return(null); }
/// <summary> /// 通过目标和buff类型判断添加buff之后造成的效果 /// </summary> /// <param name="cs"></param> /// <param name="sBuff"></param> public void AddCalculateCurTargetProp(CharacterState cs, SkillBuff sBuff) { if (CharBuffs.ContainsKey(cs)) { float resultValue = 0; List <SkillBuff> mCurSkillBuff = new List <SkillBuff>(); //持续减益/增益类buff相互抵消 if (sBuff.node.type == BuffType.continuousDecrease || sBuff.node.type == BuffType.continuousIncrease) { SkillBuff tempBuff = CharBuffs[cs].Find(a => a != sBuff && a.node.type == sBuff.node.type && a.skillNode.skill_id == sBuff.skillNode.skill_id); if (tempBuff != null) { tempBuff.Reverse(cs, tempBuff.baseValue); RemoveContinousSkillBuff(tempBuff); } } else { //查找和当前buff同类型的 mCurSkillBuff = CharBuffs[cs].FindAll(a => a != sBuff && a.node.type == sBuff.node.type && a.node.buffActionType == sBuff.node.buffActionType); } //不存在取当前值,存在取差值 if (mCurSkillBuff.Count > 0) { mCurSkillBuff.Sort((a, b) => Mathf.FloorToInt(b.baseValue - a.baseValue)); if (sBuff.baseValue > mCurSkillBuff[0].baseValue) { resultValue = sBuff.baseValue - mCurSkillBuff[0].baseValue; } } else { resultValue = sBuff.baseValue; } sBuff.Excute(cs, resultValue); } }
/// <summary> /// 显示BuffIcon /// </summary> public void OnAddBufferIcon(SpacecraftEntity target) { RectTransform view = null; if (m_UIDToRectTranform1.ContainsKey(target.GetUId())) { view = m_UIDToRectTranform1[target.GetUId()].view; } else { if (m_UIDToRectTranform2.ContainsKey(target.GetUId())) { view = m_UIDToRectTranform2[target.GetUId()].view; } else { return; } } Transform bufferIconBox = view.Find("BuffIconBox"); if (bufferIconBox == null) { return; } bufferIconBox.gameObject.SetActive(true); Transform iconTemplate = bufferIconBox.GetChild(0); iconTemplate.gameObject.SetActive(false); int index = 0; if (target.GetAllBuffs().Count > 0) { foreach (KeyValuePair <uint, Buff> buffID2Value in target.GetAllBuffs()) { SkillBuff configVO = m_SkillProxy.GetBuff((int)buffID2Value.Key); Transform iconTras; if (configVO.ByteBuffer != null) { if ((BufferType)configVO.BuffHudShow == BufferType.None) { continue; } // Debug.LogError(target.GetName() + "==============" + configVO.Id + "========" //+ target.GetAllBuffs().Count + "=======" + (BufferType)configVO.BuffHudShow); index++; if (bufferIconBox.childCount >= index) { iconTras = bufferIconBox.GetChild(index - 1); } else { iconTras = Object.Instantiate(iconTemplate); iconTras.SetParent(bufferIconBox); iconTras.localScale = Vector3.one; iconTras.localPosition = Vector3.zero; iconTras.SetAsLastSibling(); } bufferIconBox.localScale = Vector3.one; if (m_MainEntity == target) { bufferIconBox.localScale = Vector3.one * 1.5f; } if ((uint)configVO.BuffHudIcon > 0) { UIUtil.SetIconImage(iconTras.GetComponent <Image>(), (uint)configVO.BuffHudIcon); } else { Debug.LogWarning("报错" + configVO.Id); } //Debug.Log(configVO.BuffHudIcon + "-=-=-=-=-=-" + configVO.BuffHudShow); switch ((BufferType)configVO.BuffHudShow) { case BufferType.All: // 1 全体 iconTras.gameObject.SetActive(true); break; case BufferType.Friend: // 2 友方 if (m_TeamProxy.GetMember(target.GetPlayerId()) != null) { iconTras.gameObject.SetActive(true); } break; case BufferType.Enemy: // 3 敌方 if (m_MainEntity != target && m_TeamProxy.GetMember(target.GetPlayerId()) == null) { iconTras.gameObject.SetActive(true); } break; case BufferType.Self: // 4 自己 if (m_MainEntity = target) { iconTras.gameObject.SetActive(true); } break; default: break; } } } // Debug.Log(index); for (int i = index; i < bufferIconBox.childCount; i++) { bufferIconBox.GetChild(i).gameObject.SetActive(false); } } else { for (int i = 0; i < bufferIconBox.childCount; i++) { bufferIconBox.GetChild(i).gameObject.SetActive(false); } } }