//启动一个Action public bool StartAction(Action config, EventPart ep, bool high, SkillContext context = null) { ZWAction zwaction = new ZWAction(config, this, ep, high, context); this.actionList_.AddTail(zwaction); return(true); }
public void RemoveZWAction(ZWAction action) { if (this.start_ == action) { this.start_ = action.prev; } this.actionList_.Remove(action); }
public static List <ZWActionEvent> CreateEffect <T>(RoleObject ro, ZWAction farther, Action.ActionEvent aevent, out float Duration, SkillContext context = null, int index = 0, params object[] args) where T : ZWActionEvent { Duration = 0; List <ZWActionEvent> list = new List <ZWActionEvent>(); T result = null; SkillContext.FireBoll fireBoll = null; int count = aevent.Child.Length + 1; int wave = 1; if (context != null) { if (aevent.EventType == ActionEventType.FIREBALL) { if (context.targets.Count > index) { fireBoll = context.targets[index]; } } wave = context.Wave; } for (int i = 0; i < wave; i++) { for (int j = 0; j < count; j++) { if (args == null) { result = Activator.CreateInstance(typeof(T)) as T; } else { result = Activator.CreateInstance(typeof(T), args) as T; } Action.Childs child = null; if (j > 0 && aevent.Child.Length > j - 1) { child = aevent.Child[j - 1]; } result.config = aevent; result.fireBoll = fireBoll; float time = result.Initialize(ro, farther, child, aevent.Duration * i); Duration = Mathf.Max(time, Duration); list.Add(result); } } return(list); }
public void Update() { for (PListNode pos = this.start_.next, next; pos != this.actionList_; pos = next, this.start_ = next) { //先保存下一个节点 next = pos.next; ZWAction action = ( ZWAction )pos; action.Update(); } if (this.start_.next == this.actionList_) { start_ = this.actionList_; } }
//初始化 public float Initialize(RoleObject ro, ZWAction farther, Action.Childs child, float Duration) { this.parent = ro; this.farther = farther; this.Angle = config.Angle; this.Offset = config.Offset; this.StartTime = this.config.StartTime; this.PathType = config.PathType; this.OffsetMaxY = config.OffsetMaxY; if (child != null) { this.Angle += child.Angle; this.Offset += child.Offset; Duration += child.Duration; this.PathType = child.PathType; this.OffsetMaxY = child.OffsetMaxY; } this.StartTime += Duration; OnInit(); return(Duration); }