private int GetPopupIndexForComponent(CinemachineComponentBase c) { if (c != null) { var types = sStageData[(int)mStage].types; for (int i = types.Length - 1; i > 0; --i) { if (c.GetType() == types[i]) { return(i); } } } return(0); // none }
private void SetCameraAimMode() { CinemachineVirtualCamera vcam = followClearshotGO.GetComponent <CinemachineVirtualCamera>(); CinemachineComponentBase current = vcam.GetCinemachineComponent(CinemachineCore.Stage.Aim); if (current.GetType() == _agentWithFocus.Settings.cameraAimMode.GetType()) { return; } else { // Destroy the existing component (have to try to destroy all as its a generic method) vcam.DestroyCinemachineComponent <CinemachineHardLookAt>(); vcam.DestroyCinemachineComponent <CinemachineGroupComposer>(); vcam.DestroyCinemachineComponent <CinemachineHardLookAt>(); vcam.DestroyCinemachineComponent <CinemachineHardLookAt>(); vcam.DestroyCinemachineComponent <CinemachinePOV>(); } switch (_agentWithFocus.Settings.cameraAimMode) { case AgentSettingSO.CameraAimMode.Composer: vcam.AddCinemachineComponent <CinemachineComposer>(); break; case AgentSettingSO.CameraAimMode.GroupComposer: vcam.AddCinemachineComponent <CinemachineGroupComposer>(); break; case AgentSettingSO.CameraAimMode.HardLookAt: vcam.AddCinemachineComponent <CinemachineHardLookAt>(); break; case AgentSettingSO.CameraAimMode.POV: vcam.AddCinemachineComponent <CinemachinePOV>(); break; case AgentSettingSO.CameraAimMode.SameAsFollowTarget: vcam.AddCinemachineComponent <CinemachineSameAsFollowTarget>(); break; default: Debug.LogError("Sorry, don't know how to use a camera Aim policy of " + _agentWithFocus.Settings.cameraAimMode); break; } }