public void SetAllFollowTransforms(Transform followTransform) { foreach (Camera Cam in RegisteredObjects.Values) { InertialCameraController ICC = Cam.GetComponent <InertialCameraController>(); if (ICC != null) { ICC.FollowTransform = followTransform; } else { LargeScaleCamera LSC = Cam.GetComponent <LargeScaleCamera>(); if (LSC != null) { LSC.FollowTransform = followTransform; } else { throw new InvalidOperationException( "Camera " + Cam.ToString() + " does not have an InertialCameraController " + "or LargeScaleCamera component" ); } } } }
public void ProvidePlanetCamera(Camera newCamera) { MyContract.RequireArgumentNotNull(newCamera, "newCamera"); PlanetCamera = newCamera; PlanetCameraController = PlanetCamera.GetComponent <InertialCameraController>(); MyContract.RequireFieldNotNull( PlanetCameraController, "PlanetCameraController" ); }
public void ReturnToStart() { MyContract.RequireFieldNotNull(Waypoints, "Waypoints"); MyContract.RequireFieldNotNull(CameraToMove, "CameraToMove"); MyContract.RequireField(Waypoints.Count > 0, NO_WAYPOINT_EXCMSG, "Waypoints"); InertialCameraController ICC = CameraToMove.GetComponent <InertialCameraController>(); ICC.FollowTransform = Waypoints[0]; }
public void Start() { InertialCameraController MainMenuBackgroundCamera = CameraRegistry[(int)CameraRoles.MainMenuAndOrrery] .GetComponent <InertialCameraController>(); MyContract.RequireFieldNotNull(MainMenuBackgroundCamera, "MainMenuBackgroundCamera"); MainMenuBackgroundCamera.FollowTransform = MainMenuUIManager .BackgroundOrbitalBody .GetComponent <Transform>(); showUIElementFromFlags(false, UIElement_ALL); EnterMainMenuRoot(); }
SetupGameCameras (Transform initialFollowTransform) { //Debug.Log("Setting-up game cameras"); MyContract.RequireFieldNotNull( SpaceshipClassManager, "SpaceshipClassManager" ); // instantiate with initial values Vector3 CameraOffset = SpaceshipClassManager .getCameraOffset(PlayerShipClassChoice); InertialCameraController PlayerCamController = CameraRegistry[(int)CameraRoles.Player] .GetComponent <InertialCameraController>(); LargeScaleCamera NearestPlanetCamController = CameraRegistry[(int)CameraRoles.NearestPlanet] .GetComponent <LargeScaleCamera>(); LargeScaleCamera SolarSystemCamController = CameraRegistry[(int)CameraRoles.SolarSystem] .GetComponent <LargeScaleCamera>(); PlayerCamController.offset = CameraOffset; NearestPlanetCamController.CameraOffset = CameraOffset; SolarSystemCamController.CameraOffset = CameraOffset; // These shouldn't be different, // but they're manually set in the (Unity) editor // so the (human) editor could be lazy about it // and only change one setting // and forget the other 2 float MoveSpeed = PlayerCamController.moveSpeed; NearestPlanetCamController.MoveSpeed = MoveSpeed; SolarSystemCamController.MoveSpeed = MoveSpeed; float TurnSpeed = PlayerCamController.turnSpeed; NearestPlanetCamController.TurnSpeed = TurnSpeed; SolarSystemCamController.TurnSpeed = TurnSpeed; CameraRegistry.SetAllFollowTransforms(initialFollowTransform); WarpTo(CurrentNearestOrbitingBody); }