Esempio n. 1
0
    void Start()
    {
        input = gameObject.AddComponent <InputAggregator>();

        rb = GetComponent <Rigidbody>();

        contactTracker = ContactTracker.AttachOrFind(gameObject);
    }
Esempio n. 2
0
        private void InitializeInput()
        {
            InputAggregator inputAggregator = new InputAggregator();

            inputAggregator.Add(new MouseInputProcessor(new MouseInputStream()));
            inputAggregator.Add(new KeyboardProcessor(new KeyboardInputStream()));

            Platform.Instance.Input = inputAggregator;
        }
Esempio n. 3
0
 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);
 }
Esempio n. 5
0
        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());
 }
Esempio n. 9
0
 void Start()
 {
     input = gameObject.AddComponent <InputAggregator>();
 }
Esempio n. 10
0
    private void Start()
    {
        InputAggregator myThis = this;

        print("myThis.name = " + myThis.name + ", this = " + this);
    }