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); }
private void AddChildEvent() { if (this.layer >= MAX_LAYER) { return; } SkillUtils.InstanceEvent(SKILL_EVENT_TYPE.动作, skillInfo, this, layer + 1, 0); }
public void Read(BinaryReader br) { id = br.ReadInt32(); int count = br.ReadInt32(); for (int i = 0; i < count; ++i) { BaseSkillEvent bse = SkillUtils.InstSkillEvent(br, this, null, 0, i); bse.Deserialize(br); } }
public void Deserialize(BinaryReader br) { DeserializeTYpe(br); int count = br.ReadInt32(); childrenEvents.Clear(); for (int i = 0; i < count; ++i) { BaseSkillEvent bse = SkillUtils.InstSkillEvent(br, skillInfo, this, layer + 1, i); bse.Deserialize(br); } }
private void RefreshType() { if (lastType != eventType) { lastType = eventType; int index = GetParentChildrenEventList().IndexOf(this); BaseSkillEvent nbe = SkillUtils.InstanceEvent(eventType, skillInfo, parent, layer, index); for (int i = 0; i < this.childrenEvents.Count; ++i) { this.childrenEvents[i].parent = nbe; nbe.childrenEvents.Add(this.childrenEvents[i]); } DeleteEvent(); } }
private void LayerDownEvent() { if (this.GetMaxLayer() >= MAX_LAYER) { return; } List <BaseSkillEvent> parentChildrenEventList = GetParentChildrenEventList(); int index = parentChildrenEventList.IndexOf(parent); BaseSkillEvent be = SkillUtils.InstanceEvent(SKILL_EVENT_TYPE.动作, skillInfo, parent, layer, index); parentChildrenEventList.Remove(this); be.childrenEvents.Add(this); this.parent = be; ChangeLayer(1); }
public static BaseSkillEvent InstSkillEvent(BinaryReader br, SkillInfo info, BaseSkillEvent parent, int layer, int index) { SKILL_EVENT_TYPE eventType = (SKILL_EVENT_TYPE)br.ReadInt32(); BaseSkillEvent bse = SkillUtils.InstanceEvent(eventType, info, parent, layer, index); bse.time = br.ReadSingle(); bse.times = br.ReadInt32(); bse.interval = br.ReadSingle(); bse.actionTime = br.ReadSingle(); bse.key = bse.GetKey(); #if UNITY_EDITOR bse.lastType = eventType; #endif return(bse); }
private void CopyEvent() { MemoryStream ms = new MemoryStream(); BinaryWriter bw = new BinaryWriter(ms); Serialize(bw); bw.Close(); ms.Close(); byte[] bytes = ms.GetBuffer(); bw = null; ms = null; ms = new MemoryStream(bytes); BinaryReader br = new BinaryReader(ms); List <BaseSkillEvent> parentChildrenEventList = GetParentChildrenEventList(); int index = parentChildrenEventList.IndexOf(this); BaseSkillEvent bse = SkillUtils.InstSkillEvent(br, skillInfo, this.parent, layer, index + 1); bse.Deserialize(br); br.Close(); br = null; }