void Start() { input = gameObject.AddComponent <InputAggregator>(); rb = GetComponent <Rigidbody>(); contactTracker = ContactTracker.AttachOrFind(gameObject); }
private void InitializeInput() { InputAggregator inputAggregator = new InputAggregator(); inputAggregator.Add(new MouseInputProcessor(new MouseInputStream())); inputAggregator.Add(new KeyboardProcessor(new KeyboardInputStream())); Platform.Instance.Input = inputAggregator; }
public GameStateEditor(ContentManager content) { _contentManager = content; _saveAction = false; _inputAggregator = Platform.Instance.Input; _debugViewGridstep = UnitsConverter.ToSimUnits(1f); _gridColor = new Color(128, 128, 128, 80); _debugViewGrid = true; }
/// <summary> /// Returns true if there is an event that has the specified button pressed, or false if none exists /// </summary> public static bool HasEvent(this InputAggregator inputAggregator, UISButton uisButton, bool firstTime = false) { return(inputAggregator.GetEvents <ButtonsPressedEvent>(). FirstOrDefault(ev => { bool value; if (ev.PressedButtons.TryGetValue(uisButton, out value)) { return value == firstTime; } return false; }) != null); }
public void TestAggregate() { var a = new InputAggregator(); using (var hidMonitor = new HumanInterfaceDeviceMonitor()) using (new System.Reactive.Disposables.CompositeDisposable( ObservableTimeInterval.GetSeconds().Take(10).Subscribe(a.Time), hidMonitor.Mouse.Subscribe(a.Mouse), hidMonitor.KeyDown.Subscribe(a.KeyDown), hidMonitor.Mouse.ToDistance().Subscribe(_ => log.Info(_)), a.Input.Subscribe(_ => log.Info(_.MouseMove)) )) { a.Input.Wait(); } }
public EditorToolsController() { _leftClick = false; _dragging = false; _state = EditorState.None; _clicks = 0; _moveTime = -1; _rotateTime = -1; _externalRotateTime = -1; _prefabs = new List <string>(PrefabRepository.Instance.PrefabNames); _selectedPrefab = 0; _lastLayerSelected = Category.Cat1; _lastSelectedZ = 0f; _specialRotationBigOperator = ( float )(Math.PI / 6f); _specialRotationSmallOperator = ( float )(Math.PI / 18f); _inputAggregator = Platform.Instance.Input; }
/// <summary> /// Gets all events of the specified type /// </summary> /// <returns>A list of <see cref="IInputEvent"/>s</returns> public static IEnumerable <GestureEvent> GetGestures(this InputAggregator inputAggregator, GestureType gestureType, GestureSource gestureSource = GestureSource.Left) { return(inputAggregator.GetEvents <GestureEvent>().Where( ev => (ev.Gesture & gestureType) != 0 && ev.Source == gestureSource)); }
/// <summary> /// Gets the first event of the specified type, or null if none exists /// </summary> /// <returns>An <see cref="IInputEvent"/> or null if none exists</returns> public static GestureEvent GetGesture(this InputAggregator inputAggregator, GestureType gestureType, GestureSource gestureSource = GestureSource.Left) { return(GetGestures(inputAggregator, gestureType, gestureSource).FirstOrDefault()); }
void Start() { input = gameObject.AddComponent <InputAggregator>(); }
private void Start() { InputAggregator myThis = this; print("myThis.name = " + myThis.name + ", this = " + this); }