void Update()
    {
        //get inputs
        _mouseInput.x = Input.GetAxisRaw("Mouse X") * _lookSensitivity.x;
        _mouseInput.y = Input.GetAxisRaw("Mouse Y") * _lookSensitivity.y;

        _movementInput.x = Input.GetAxisRaw("Horizontal");
        _movementInput.y = Input.GetAxisRaw("Vertical");
        _movementInput.Normalize();

        if (!_invertY)
        {
            _mouseInput.y *= -1f;
        }

        if (Input.GetKeyDown(KeyCode.T))
        {
            GlobalEventBus.Raise(GlobalEvent.ToggleSlowMotion);
        }
        if (Input.GetKeyDown(KeyCode.Space))
        {
            _entity.events.Raise(LocalEvent.Jump);
        }

        if (Input.GetKey(KeyCode.Mouse0))
        {
            _entity.events.Raise(LocalEvent.Fire);
        }

        _entity.events.Raise(LocalEvent.UpdateAimingInput, Input.GetKey(KeyCode.Mouse1));
        _entity.events.Raise(LocalEvent.UpdateCrouchInput, Input.GetKey(KeyCode.LeftControl));
    }
Beispiel #2
0
 public void given_a_handler_subscribed_at_an_outer_scope()
 {
     globalBus = new GlobalEventBus();
     globalBus.Subscribe<EventMessage>(outerSubscriber);
 }
Beispiel #3
0
 void Awake()
 {
     GlobalEventBus.Initialize();
 }
Beispiel #4
0
 void Start()
 {
     GlobalEventBus.Subscribe(GlobalEvent.ToggleSlowMotion, (object[] args) => Toggle());
 }