private void UpdateCamPos(CamPosition nextPos) { // Return if no change in pos if (nextPos == currentCamPos || nextPos == CamPosition.None) { return; } switch (nextPos) { case CamPosition.TopDown: transform.SetParent((Transform)allCamPositions[1], worldPositionStays: false); break; case CamPosition.RearForward: transform.SetParent((Transform)allCamPositions[2], worldPositionStays: false); break; case CamPosition.LeftForward: transform.SetParent((Transform)allCamPositions[3], worldPositionStays: false); break; case CamPosition.Selfie: transform.SetParent((Transform)allCamPositions[4], worldPositionStays: false); break; } currentCamPos = nextPos; }
private void Init() { Debug.Assert((camPosCollectionParent != null), "CamPosController, Init - camPosCollectionParent is not assigned in the editor"); allCamPositions = camPosCollectionParent.GetComponentsInChildren <Transform>(); Debug.Assert((allCamPositions.Length > 0), "CamPosController, Init - No children assigned to camPosCollectionParent. Must have at least 1 child."); transform.SetParent((Transform)allCamPositions[1], worldPositionStays: false); currentCamPos = CamPosition.RearForward; }
private void C_SetCamTo(CamPosition pos, float speedFactor) { switch (pos) { case CamPosition.STANDART: cameraLerpEndPos = CamPos_Original.transform.position; cameraLerpEndRot = CamPos_Original.transform.rotation; cameraLerpEndFOV = CamPos_Original.fieldOfView; break; case CamPosition.VIDEO_MAKER: cameraLerpEndPos = CamPos_VideoMaker.transform.position; cameraLerpEndRot = CamPos_VideoMaker.transform.rotation; cameraLerpEndFOV = CamPos_VideoMaker.fieldOfView; break; case CamPosition.VIDEO_MAKER_FAR: cameraLerpEndPos = CamPos_VideoMaker_Far.transform.position; cameraLerpEndRot = CamPos_VideoMaker_Far.transform.rotation; cameraLerpEndFOV = CamPos_VideoMaker_Far.fieldOfView; break; case CamPosition.FLOWCHART_1: cameraLerpEndPos = CamPos_TopDown0.transform.position; cameraLerpEndRot = CamPos_TopDown0.transform.rotation; cameraLerpEndFOV = CamPos_TopDown0.fieldOfView; break; } cameraLerpStartPos = cam.transform.position; cameraLerpStartRot = cam.transform.rotation; cameraLerpStartFOV = cam.fieldOfView; cameraLerpTimer = 0; cameraLerpActive = true; cameraLerpFactor = speedFactor; }