浏览代码

Fix to camera shake bug

Removed lambda expression
Added unregister from the event
Removed unnecessary null checks
/main
Ciro Continisio 4 年前
当前提交
5df561c9
共有 1 个文件被更改,包括 4 次插入7 次删除
  1. 11
      UOP1_Project/Assets/Scripts/Camera/CameraManager.cs

11
UOP1_Project/Assets/Scripts/Camera/CameraManager.cs


inputReader.enableMouseControlCameraEvent += OnEnableMouseControlCamera;
inputReader.disableMouseControlCameraEvent += OnDisableMouseControlCamera;
if (_frameObjectChannel != null)
_frameObjectChannel.OnEventRaised += OnFrameObjectEvent;
if (_camShakeEvent != null)
_camShakeEvent.OnEventRaised += () => impulseSource.GenerateImpulse();
_frameObjectChannel.OnEventRaised += OnFrameObjectEvent;
_camShakeEvent.OnEventRaised += impulseSource.GenerateImpulse;
_cameraTransformAnchor.Transform = mainCamera.transform;
}

inputReader.enableMouseControlCameraEvent -= OnEnableMouseControlCamera;
inputReader.disableMouseControlCameraEvent -= OnDisableMouseControlCamera;
if (_frameObjectChannel != null)
_frameObjectChannel.OnEventRaised -= OnFrameObjectEvent;
_frameObjectChannel.OnEventRaised -= OnFrameObjectEvent;
_camShakeEvent.OnEventRaised -= impulseSource.GenerateImpulse;
}
private void OnEnableMouseControlCamera()

正在加载...
取消
保存