/// <summary> /// Assigns the gaze-aware behavior to an interactor. /// </summary> /// <param name="interactor">Interactor to assign the gaze-aware interactor to.</param> public void AssignBehavior(Interactor interactor) { using (var behavior = interactor.CreateBehavior(BehaviorType.GazeAware)) { if (DelayMilliseconds > 0) { var parameters = new GazeAwareParams { GazeAwareMode = GazeAwareMode.Delayed, DelayTime = DelayMilliseconds }; behavior.SetGazeAwareParams(ref parameters); } } }
public void AssignBehavior(Interactor interactor) { using (var behavior = interactor.CreateBehavior(BehaviorType.GazeAware)) { if (DelayTime > 0) { var gazeAwareParams = new GazeAwareParams() { GazeAwareMode = GazeAwareMode.Delayed, DelayTime = DelayTime }; behavior.SetGazeAwareParams(ref gazeAwareParams); } } }
/// <summary> /// Adds the interactor to the given snapshot. /// </summary> /// <param name="snapshot">Interaction snapshot.</param> /// <param name="windowId">ID of the game window.</param> /// <param name="gameWindowPosition">Position of the game window in screen coordinates.</param> public void AddToSnapshot(InteractionSnapshot snapshot, string windowId, Vector2 gameWindowPosition) { var interactor = snapshot.CreateInteractor(_id, _parentId, windowId); var bounds = interactor.CreateBounds(InteractionBoundsType.Rectangular); bounds.SetRectangularData(Location.rect.x + gameWindowPosition.x, Location.rect.y + gameWindowPosition.y, Location.rect.width, Location.rect.height); interactor.Z = Location.relativeZ; if (Mask != null && Mask.Type != EyeXMaskType.None) { interactor.CreateMask(MaskType.Default, Mask.Size, Mask.Size, Mask.MaskData); } if ((_behaviors & EyeXBehaviors.Activatable) != 0) { var behaviorParams = new ActivatableParams { EnableTentativeFocus = EyeXBoolean.False }; interactor.SetActivatableBehavior(ref behaviorParams); } if ((_behaviors & EyeXBehaviors.ActivatableWithTentativeFocus) != 0) { var behaviorParams = new ActivatableParams { EnableTentativeFocus = EyeXBoolean.True }; interactor.SetActivatableBehavior(ref behaviorParams); } if ((_behaviors & EyeXBehaviors.GazeAware) != 0) { interactor.CreateBehavior(InteractionBehaviorType.GazeAware); } if ((_behaviors & EyeXBehaviors.GazeAwareWithInertia) != 0) { var gazeAwareParams = new GazeAwareParams() { GazeAwareMode = GazeAwareMode.Delayed, DelayTime = 500 }; interactor.SetGazeAwareBehavior(ref gazeAwareParams); } if (_behaviorCallback != null) { _behaviorCallback(_id, interactor); } }