public bool Update(float elapseTime) { if (finished) { return(true); } timer += elapseTime; if (!executed && timer >= delay) { executed = true; if (skillEvt.times <= 0) { finished = true; return(true); } Execute(); } if (executed) { if (SKILL_EVENT_TYPE.子弹 == skillEvt.eventType || SKILL_EVENT_TYPE.AOE == skillEvt.eventType || SKILL_EVENT_TYPE.位移 == skillEvt.eventType) { return(true); } bool finish = true; for (int i = 0; i < spList.Count; ++i) { SkillProgress sp = spList[i]; finish = sp.Update(elapseTime) && finish; } return(finish); } return(false); }
public SkillProgress GetSkillProgress(bool addToUpdateList) { SkillProgress sp = null; sp = new SkillProgress(); return(sp); }
public void InitEvt(BaseSkillEvent evt, int skillId, float delay, int spid, int group) { this.spid = spid; this.skillEvt = evt; this.delay = delay; this.skillId = skillId; int num = 1; group *= 100; for (int i = 0; i < evt.childrenEvents.Count; ++i) { BaseSkillEvent bse = evt.childrenEvents[i]; if (SKILL_EVENT_TYPE.子弹 == bse.eventType) { for (int j = 0; j < bse.times; ++j) { SkillProgress sp = SkillProgressCtrl.Instance.GetSkillProgress(false); spList.Add(sp); sp.InitEvt(bse, skillId, bse.time + bse.interval * j, group * num + spid, group); ++num; } } else { SkillProgress sp = SkillProgressCtrl.Instance.GetSkillProgress(false); sp.InitEvt(bse, skillId, bse.time, group * num + spid, group); ++num; spList.Add(sp); } } }
private void CreateBullet(Vector3 beginPos, Vector3 dir, float speed) { SkillProgress sp = SkillUtils.CopySkillProgress(this, false, false, true); Bullet bullet = BulletMgr.Instance.GetObj(); bullet.Active(sp.skillEvt as SkillEventBullet, beginPos, dir, speed); }
public static SkillProgress CopySkillProgress(SkillProgress from, bool executed, bool finished, bool AddToUpdateList) { SkillProgress copy = SkillProgressCtrl.Instance.GetSkillProgress(AddToUpdateList); copy.executed = executed; copy.finished = finished; copy.timer = from.timer; copy.delay = from.delay; copy.spid = from.spid; copy.isSync = from.isSync; copy.skillId = from.skillId; copy.skillEvt = from.skillEvt; copy.casterData = from.casterData; copy.targetData = from.targetData; if (SKILL_EVENT_TYPE.伤害 == from.skillEvt.eventType) { Array.Copy(from.casterAttrs, copy.casterAttrs, from.casterAttrs.Length); } for (int i = 0; i < from.spList.Count; ++i) { SkillProgress childSp = from.spList[i]; if (from.skillEvt is SkillEventBullet && childSp.skillEvt is SkillEventWarn) { continue; } copy.spList.Add(SkillUtils.CopySkillProgress(childSp, false, false, false)); } return(copy); }
public SkillProgressCtrl() { _cacheList = new List <SkillProgress>(); _reclaimList = new List <SkillProgress>(); _waitList = new List <SkillProgress>(); for (int i = 0; i < DEFAULT_CAPACITY; ++i) { SkillProgress sp = new SkillProgress(); sp.ResetID(); _cacheList.Add(sp); } _lastTime = Time.time; }
public void SetSkillProgressData(int lv, SkillCasterData casterData, SkillPreData preData, SkillTargetData targetData, bool isSync) { this.isSync = isSync; this.casterData = casterData; this.preData = preData; this.targetData = targetData; if (skillEvt.eventType == SKILL_EVENT_TYPE.伤害) { EntityBase caster = EntityMgr.Instance.GetEntity(this.casterData.roleType, (uint)this.casterData.roleId); } for (int i = 0; i < spList.Count; ++i) { SkillProgress sp = spList[i]; sp.SetSkillProgressData(lv, casterData, preData, targetData, isSync); } }