public void InitCamera(NodeAddedEvent evt, SpectatorTransitionCameraNode transitionCameraNode, TankNode tank, [Context, JoinByTank] WeaponNode weapon, [JoinByUser] FollowedUserNode followedUser) { float flyTimeSec = 0.55f; float flyHeight = 1f; if (transitionCameraNode.transitionCamera.Spawn) { SpawnCameraConfigUnityComponent spawnCameraConfigUnity = transitionCameraNode.spawnCameraConfigUnity; flyTimeSec = spawnCameraConfigUnity.FlyTimeSec; flyHeight = spawnCameraConfigUnity.FlyHeight; } else { TransitionCameraConfigUnityComponent transitionCameraConfigUnity = transitionCameraNode.transitionCameraConfigUnity; flyTimeSec = transitionCameraConfigUnity.FlyTimeSec; flyHeight = transitionCameraConfigUnity.FlyHeight; } CameraType type = transitionCameraNode.transitionCamera.CameraSaveData.Type; if (type == CameraType.Follow) { this.InitFollowCamera(transitionCameraNode, weapon, tank, flyTimeSec, flyHeight); } else if (type == CameraType.MouseOrbit) { TransformData data = MouseOrbitCameraUtils.GetTargetMouseOrbitCameraTransformData(weapon.cameraTarget.TargetObject.transform, transitionCameraNode.transitionCamera.CameraSaveData.MouseOrbitDistance, transitionCameraNode.transitionCamera.CameraSaveData.MouseOrbitTargetRotation); InitCamera(transitionCameraNode, data.Position, data.Rotation.eulerAngles, flyTimeSec, flyHeight); } }
public void InitCamera(NodeAddedEvent evt, SpectatorTransitionCameraNode transitionCameraNode) { TransitionCameraConfigUnityComponent transitionCameraConfigUnity = transitionCameraNode.transitionCameraConfigUnity; if (transitionCameraNode.transitionCamera.CameraSaveData.Type == CameraType.Free) { TransformData transformData = transitionCameraNode.transitionCamera.CameraSaveData.TransformData; Vector3 position = transformData.Position; InitCamera(transitionCameraNode, position, transformData.Rotation.eulerAngles, transitionCameraConfigUnity.FlyTimeSec, transitionCameraConfigUnity.FlyHeight); } }