private void UpdateActionSet(GameTime gametime) { while (actionsets.Count > 0 && currentactionset == null) { currentactionset = actionsets[0]; Console.WriteLine(string.Format("Now action is {0}", currentactionset.animname)); State = currentactionset.state; switch (currentactionset.factor) { case CharacterActionSetChangeFactor.AnimationCompleted: { break; } case CharacterActionSetChangeFactor.ArriveTarget: { Target = currentactionset.target; OnArrived += new EventHandler(OnUpdateActionSets); break; } case CharacterActionSetChangeFactor.ArriveAttackTarget: { break; } case CharacterActionSetChangeFactor.ArriveInteractiveTarget: { break; } case CharacterActionSetChangeFactor.EffectCompleted: { break; } case CharacterActionSetChangeFactor.Immediate: { OnUpdateActionSets(this, new EventArgs()); break; } } } if (currentactionset != null) { } }
public void ClearActionSet() { actionsets.Clear(); currentactionset = null; }
private void OnUpdateActionSets(object sender, EventArgs e) { if (actionsets.Count > 0) { actionsets.RemoveAt(0); if (actionsets.Count == 0 && currentactionset != null) { if (OnActionCompleted != null && currentactionset.factor != CharacterActionSetChangeFactor.Immediate) { OnActionCompleted(this, new EventArgs()); //OnActionCompleted = null; } } } currentactionset = null; }
public void AddActionSetPre(string animname, CharacterState state, CharacterActionSetChangeFactor factor, object o) { CharacterActionSet cas = new CharacterActionSet(animname, state, factor, o); actionsets.Insert(0, cas); }