private void Awake() { if (Instance != null) { Destroy(gameObject); } else { Instance = this; DontDestroyOnLoad(this); } panelController = GetComponent <UIPanel>(); Assert.IsNotNull(panelController); //CamAnimator[] camAnims = GetComponentsInChildren<CamAnimator>(); //foreach(CamAnimator camAnimator in camAnims) //{ // if (camAnimator != null) // { // cameraAnimators.SetValue(camAnimator, (int)camAnimator.CameraPanel.camPosition); // } //} for (CameraPanel.DisplayPosition camPos = 0; camPos < CameraPanel.DisplayPosition.NumPositions; ++camPos) { if (LevelController.Instance.LevelCollection.levels[LevelController.Instance.levelIndex].cameraToggles[(int)camPos]) { GameObject camObj = Instantiate(CameraPrefabs[(int)camPos]); camObj.transform.parent = gameObject.transform; cameraAnimators[(int)camPos] = camObj.GetComponent <CamAnimator>(); GameObject camModel = camObj.GetComponentInChildren <ScalePulser>().gameObject; Vector3 localPos = camModel.transform.localPosition; camModel.transform.localPosition = new Vector3(localPos.x, localPos.y, LevelController.Instance.worldSettings.worldExtent); } } }
public override void PlayerEnteredTrigger(CubeController player) { if (player != null) { CamAnimator camAnim = UDLRCameraController.GetSelectedCameraAnimator(); UDLRCameraController.RotateCameras(camAnim.transform, arcType, AnimCurve.MotionType.Linear); //transform.position = startingTransform.position; //transform.rotation = startingTransform.rotation; //transform.localScale = startingTransform.localScale; //if (camAnim != null) // camAnim.rotator.StartArc(camAnim.transform, arcType, Vector3.zero, AnimCurve.MotionType.Linear); } }
void TryStartRotation() { if (LevelController.GetMazeState() == LevelController.MazeState.InProgress) { CamAnimator camAnim = UDLRCameraController.GetSelectedCameraAnimator(); if (camAnim != null && camAnim.rotator.animationState == Rotator.AnimationState.Stationary) { rotator.StartArc(camAnim.transform, GetRotationDirection(), transform.position, AnimCurve.MotionType.Exponential); timeSinceLastRotationStart = 0.0f; needsStartRotation = false; } } }
// Start is called before the first frame update void Start() { moveTargetPos = transform.position; moveTargetPos = transform.position; moveVec = Vector3.zero; if (UDLRCameraController.Instance != null) { UDLRCameraController.Instance.OnSelectedCameraChanged += SelectedCameraChanged; } SelectedCameraChanged(UDLRCameraController.GetSelectedCameraAnimator()); }
public void OnRight(InputAction.CallbackContext context) { if (UDLRCameraController.Instance != null) { CubeController cubeController = GetCubeForCameraPanelPosition(UDLRCameraController.Instance.selectedPosition); if (cubeController != null) { //move cube according to selected camera CamAnimator selectedCam = UDLRCameraController.GetSelectedCameraAnimator(); Vector3 movementVec = selectedCam != null ? selectedCam.transform.right : Vector3.zero; movementVec.Normalize(); cubeController?.MoveInDirection(movementVec); lastMovementDirection = UIPanel.MovementDirection.Right; } } }