public override void Start(object param) { IsSubFace = false; SendEvent(BehaviorPlan.ActionEventType.start); bec = (BehaviorExecutionContext)param; Apply(bec); if (endTime.Type == SyncPointType.Absolute) { Thread.Sleep((int)Math.Round(Math.Max(0, endTime.AbsoluteValue - BehaviorPlan.Instance.SolveSyncPoint(startTime)) * 1000)); End(bec); } }
public bool Launch(BehaviorExecutionContext bec) { if (!RequiredAction || (RequiredAction && ParentNode != null && (ParentNode as Required).IsValid())) { if (startTime.Offset > 0) { tAction = new Thread(new ParameterizedThreadStart(OffsetStart)); BehaviorManager.Instance.DebugIf("all", "Launching action(offset): " + Id); tAction.Start(bec); } else { tAction = new Thread(new ParameterizedThreadStart(Start)); BehaviorManager.Instance.DebugIf("all", "Launching action: " + Id); tAction.Start(bec); } return true; } else { return false; } }
public override void End(BehaviorExecutionContext bec) { ClientsInterface body = bec.Character.Clients; base.End(bec); }
protected void PerformGaze(BehaviorExecutionContext bec) { ClientsInterface body = bec.Character.Clients; bool trackfaces = false; Vector v = new Vector(2); v[0]=0; v[1]=0; /*bool cameraSurface = false; bool screenSurface = false;*/ string target = Target.ToLower(); if (target == "trackfaces") { trackfaces = true; /*case "camera": cameraSurface = true; break; case "screen": screenSurface = true; break;*/ } else if (target.Contains("h:") || target.Contains("v:")) { string[] split = target.Split(' '); foreach (string param in split) { if (param.StartsWith("h:")) { try { v[0] = double.Parse(param.Substring(2).Trim()); }catch{} } if (param.StartsWith("v:")) { try { v[1] = double.Parse(param.Substring(2).Trim()); } catch { } } } body.Gaze(Id, (double)v[0], (double)v[1], Speed, trackfaces); return; } if (trackfaces || Target == "" || !TrackingManager.Instance.Trackers.ContainsKey(Target)) { double angle = OffsetAngle; //if (angle == 0) angle = 90; switch (OffsetDirection) { case Direction.Down: v[1] = -angle; break; case Direction.Up: v[1] = angle; break; case Direction.Left: v[0] = angle; break; case Direction.Right: v[0] = -angle; break; case Direction.DownLeft: v[0] = angle; v[1] = -angle; break; case Direction.DownRight: v[0] = -angle; v[1] = -angle; break; case Direction.UpLeft: v[0] = angle; v[1] = angle; break; case Direction.UpRight: v[0] = -angle; v[1] = angle; break; default: v[0] = angle; v[1] = angle; break; } body.Gaze(Id, (double)v[0], (double)v[1], Speed, trackfaces); } else { body.Gaze(Id, (double)TrackingManager.Instance.Trackers[Target].HorizontalAngle, (double)TrackingManager.Instance.Trackers[Target].VerticalAngle, Speed, trackfaces); } }
public override void End(BehaviorExecutionContext bec) { bec.Character.Clients.StopSound(Id); }
public override void Start(object param) { SendEvent(BehaviorPlan.ActionEventType.start); bec = (BehaviorExecutionContext)param; AwaitingIds = new List<string>(); foreach (FaceFacs ff in Facs) { AwaitingIds.Add(ff.Id); ff.AnimationEnd += new FaceFacs.AnimationEndHandler(SubFaceEnded); ff.Apply(bec); } foreach (FaceLexeme fl in Lexemes) { AwaitingIds.Add(fl.Id); fl.AnimationEnd += new FaceLexeme.AnimationEndHandler(SubFaceEnded); fl.Apply(bec); } if (endTime.Type == SyncPointType.Absolute) { Thread.Sleep((int)Math.Round(Math.Max(0, endTime.AbsoluteValue - BehaviorPlan.Instance.SolveSyncPoint(startTime)) * 1000)); End(bec); } }
public override void End(BehaviorExecutionContext bec) { bec.Character.Clients.Pointing(Id, "", Speed); }
public override void End(BehaviorExecutionContext bec) { bec.Character.Clients.Head(Id, "", Repetitions, Frequency); }
public void Remove(BehaviorExecutionContext bec) { }
public void Apply(BehaviorExecutionContext bec) { ClientsInterface body = bec.Character.Clients; body.FaceLexeme(Id,Lexeme); bec.Character.AnimationEnd += new Character.AnimationEndHandler(LexemeEnd); }
public virtual void Failed(BehaviorExecutionContext bec) { if (RequiredAction && ParentNode != null) (ParentNode as Required).Failed(); SendEvent(BehaviorPlan.ActionEventType.endx); }
public virtual void Event(BehaviorPlan.ActionEventType ev, BehaviorExecutionContext bec) { switch (ev) { case BehaviorPlan.ActionEventType.start: Launch(bec); break; case BehaviorPlan.ActionEventType.end: End(bec); break; } }
public virtual void End(BehaviorExecutionContext bec) { SendEvent(BehaviorPlan.ActionEventType.end); }
public void Apply(BehaviorExecutionContext bec) { ClientsInterface body = bec.Character.Clients; body.FaceFacs(Id, AU, Side, Amount); bec.Character.AnimationEnd += new Character.AnimationEndHandler(FacsEnd); }