/// <summary> /// 支持创建多个不同的触发器 /// </summary> private void CreateTrigger() { //int val = m_buffData.ParamValue1; BuffTriggerCsv buffCsv = CsvManager.Inst.GetCsv <BuffTriggerCsv>((int)eAllCSV.eAc_BuffTrigger); for (int i = 0; i < m_buffData.listParam.Length; i++) { int triId = m_buffData.listParam[i]; if (triId == 0) { continue; } BuffTriggerCsvData triggerData = buffCsv.GetData(triId); if (triggerData == null) { Debug.LogError("触发器为空:" + triId); return; } if (triggerData.DelayCreateTime == 0) { CreateTrigger(triggerData); } else { m_delayEventHid = CFrameTimeMgr.Inst.RegisterEvent(triggerData.DelayCreateTime, () => { CreateTrigger(triggerData); }); } //Debug.Log("技能流程:创建检测器:" + triId + " " + triggerData.Name); } }
public override bool Create(int csvId, string name, Vector2d pos, Vector2d dir, float scale = 1) { // 通过不同类型,读取不同配置表 BuffTriggerCsv buffCsv = CsvManager.Inst.GetCsv <BuffTriggerCsv>((int)eAllCSV.eAc_BuffTrigger); m_triggerData = buffCsv.GetData(csvId); InitPos(ref pos, ref dir); if (m_triggerData.ModelResId != 0) { // 表现 m_vCreature = VObjectMgr.Create(eVOjectType.SkillTrigger); sVOjectBaseInfo info = new sVOjectBaseInfo(); info.m_resId = m_triggerData.ModelResId; info.m_pos = pos.ToVector3() + Vector3.up * m_triggerData.vBulletDeltaPos.y; info.m_dir = dir.ToVector3(); info.m_headHeight = m_triggerData.HeadHeight; info.m_showHead = false; m_vCreature.Create(info); } SetPos(pos, true); SetDir(dir); SetScale(scale); SetSpeed(new FixedPoint(m_triggerData.FlySpeed)); CFrameTimeMgr.Inst.RegisterEvent(m_triggerData.ContinuanceTime, () => { if (!m_destroy) { Destory(); } }); if (m_triggerData.DelayCheckTime == 0) { m_bStartCheck = true; Trigger(); } else { CFrameTimeMgr.Inst.RegisterEvent(m_triggerData.DelayCheckTime, () => { m_bStartCheck = true; Trigger(); }); } InitObstacle(pos); return(true); }
private void CreateTrigger(BuffTriggerCsvData data) { CBuffTrigger buffTri = CBuffTriggerMgr.Create((eBuffTriggerPosType)data.PosType); buffTri.m_caster = m_caster; buffTri.m_rec = m_rec; buffTri.m_skillIndex = m_skillIndex; buffTri.m_skillPos = m_skillPos; buffTri.m_extendParam = m_extendParam; buffTri.Create(data.Id, string.Empty, m_startPos, m_skillDir); if (m_caster != null) { m_caster.AddTrigger((int)buffTri.GetUid()); } }
protected override void _Load() { m_dicData.Clear(); for (int i = 0; i < m_csv.GetRows(); i++) { BuffTriggerCsvData data = new BuffTriggerCsvData(); data.Id = m_csv.GetIntData(i, (int)eBuffTriggerCsv.Id); data.Name = m_csv.GetData(i, (int)eBuffTriggerCsv.Name); data.Icon = m_csv.GetIntData(i, (int)eBuffTriggerCsv.Icon); data.ModelResId = m_csv.GetIntData(i, (int)eBuffTriggerCsv.ModelResId); data.HeadHeight = m_csv.GetIntData(i, (int)eBuffTriggerCsv.HeadHeight); data.PosType = m_csv.GetIntData(i, (int)eBuffTriggerCsv.PosType); data.bBullet = m_csv.GetBoolData(i, (int)eBuffTriggerCsv.bBullet); data.bAutoTrigger = m_csv.GetBoolData(i, (int)eBuffTriggerCsv.bAutoTrigger); // 起点偏移 男性 data.BulletDeltaPos = m_csv.GetData(i, (int)eBuffTriggerCsv.BulletDeltaPos); if (!string.IsNullOrEmpty(data.BulletDeltaPos)) { string[] str = data.BulletDeltaPos.Split('|'); if (str.Length == 1) { data.vBulletDeltaPos = StringHelper.GetVector3(data.BulletDeltaPos); } else if (str.Length == 2) { data.vBulletDeltaPos = StringHelper.GetVector3(str[0]); float h = 0; float.TryParse(str[1], out h); data.iCurveHeight = h; } } // 起点偏移 女性 data.BulletDeltaPos = m_csv.GetData(i, (int)eBuffTriggerCsv.BulletDeltaPosWoman); if (!string.IsNullOrEmpty(data.BulletDeltaPos)) { string[] str = data.BulletDeltaPos.Split('|'); if (str.Length == 1) { data.vBulletDeltaPos_Woman = StringHelper.GetVector3(data.BulletDeltaPos); } else if (str.Length == 2) { data.vBulletDeltaPos_Woman = StringHelper.GetVector3(str[0]); float h = 0; float.TryParse(str[1], out h); data.iCurveHeight_Woman = h; } } // 扩展参数 string posParam = m_csv.GetData(i, (int)eBuffTriggerCsv.DirDelta); string[] strParam = posParam.Split('_'); if (strParam.Length == 1) // 方向 { int h = 0; int.TryParse(strParam[0], out h); data.dirDelta = h; } else if (strParam.Length == 2) // 方向+位置 { int h = 0; int.TryParse(strParam[0], out h); data.dirDelta = h; int dis = 0; int.TryParse(strParam[1], out dis); data.disDelta = dis; } data.FlySpeed = m_csv.GetFloatData(i, (int)eBuffTriggerCsv.FlySpeed); data.DelayCreateTime = m_csv.GetIntData(i, (int)eBuffTriggerCsv.DelayTime); data.DelayCheckTime = m_csv.GetIntData(i, (int)eBuffTriggerCsv.DelayCheckTime); data.ContinuanceTime = m_csv.GetIntData(i, (int)eBuffTriggerCsv.ContinuanceTime); data.IntervalTime = m_csv.GetIntData(i, (int)eBuffTriggerCsv.IntervalTime); data.ShapeType = m_csv.GetIntData(i, (int)eBuffTriggerCsv.ShapeType); data.Length = m_csv.GetFloatData(i, (int)eBuffTriggerCsv.Length); data.Width = m_csv.GetFloatData(i, (int)eBuffTriggerCsv.Width); data.Obstacle = m_csv.GetBoolData(i, (int)eBuffTriggerCsv.Obstacle); string b1 = m_csv.GetData(i, (int)eBuffTriggerCsv.Buff1); data.selfBuffList = StringHelper.GetIntList(b1); string b2 = m_csv.GetData(i, (int)eBuffTriggerCsv.Buff2); data.targetBuffList = StringHelper.GetIntList(b2); m_dicData.Add(data.Id, data); } }