public void setToOnPosition() { this.currentState = cameraStates.onPosition; this.transform.localEulerAngles = new Vector3(0, this.cataCrux.parent.localEulerAngles.y - 90, 0); Camera.main.transform.localPosition = new Vector3(-8, 24, 0); Camera.main.transform.localEulerAngles = new Vector3(90, -270, -180); }
public void nextPress() { switch (currentState) { case states.MAIN_MENU: { //Button not visible in this state break; } case states.HELLO: { tryPress(); animator.SetTrigger("WHATS_UP"); titleText.text = words[2]; currentState = states.WHATS_UP; break; } case states.WHATS_UP: { tryPress(); animator.SetTrigger("WHAT_IS_YOUR_NAME"); titleText.text = words[3]; currentState = states.WHAT_IS_YOUR_NAME; break; } case states.WHAT_IS_YOUR_NAME: { tryPress(); animator.SetTrigger("NICE"); titleText.text = words[4]; currentState = states.NICE; break; } case states.NICE: { tryPress(); animator.SetTrigger("NICE_TO_MEET_YOU"); titleText.text = words[5]; currentState = states.NICE_TO_MEET_YOU; break; } case states.NICE_TO_MEET_YOU: { currentCameraState = cameraStates.ORIGINAL; cameraAnimator.SetTrigger("CAMERA_REVERSE_SPAN"); animator.SetTrigger("WAIT"); buttonText.text = buttonTexts[0]; titleText.text = words[0]; currentState = states.MAIN_MENU; break; } } }
// Update is called once per frame void Update() { if (Input.GetButton("Fire3")) { camState = cameraStates.target; } else { camState = cameraStates.behind; } }
// Use this for initialization void Start() { this.cameraAimObject = this.cataCrux.transform; this.transform.localPosition = this.cameraAimObject.transform.position; currentState = cameraStates.onPosition; this.zoomPosition = 0; zoomDistances.Add(24); zoomDistances.Add(32); zoomDistances.Add(40); }
void Start() { currentState = states.MAIN_MENU; currentCameraState = cameraStates.INIT; titleText = GetComponent <Text>(); titleText = GameObject.Find("TitleText").GetComponent <Text>(); titleText.text = words[0]; buttonText = GameObject.Find("ButtonText").GetComponent <Text>(); buttonText.text = buttonTexts[0]; resultImage = GameObject.Find("ResultImage").GetComponent <Image>(); correct = Resources.Load <Sprite>("correct"); incorrect = Resources.Load <Sprite>("incorrect"); animator = GameObject.Find("Human").GetComponent <Animator>(); cameraAnimator = GameObject.Find("GameObject").GetComponent <Animator>(); }
// Update is called once per frame void Update() { switch (state) { case cameraStates.DEFAULT: if (!cameraBounds.Contains(player.transform.position)) { state = cameraStates.FOLLOW; } break; case cameraStates.FOLLOW: transform.position = player.transform.position + offset; break; default: break; } }
public void tryPress() { if (currentState == states.MAIN_MENU) { animator.SetTrigger("HELLO"); buttonText.text = buttonTexts[1]; titleText.text = words[1]; currentState = states.HELLO; } else { switch (currentCameraState) { case cameraStates.INIT: { currentCameraState = cameraStates.SPANNED; cameraAnimator.SetTrigger("INIT"); break; } case cameraStates.ORIGINAL: { currentCameraState = cameraStates.SPANNED; cameraAnimator.SetTrigger("CAMERA_SPAN"); break; } case cameraStates.SPANNED: { currentCameraState = cameraStates.ORIGINAL; cameraAnimator.SetTrigger("CAMERA_REVERSE_SPAN"); break; } } } }
// Update is called once per frame void Update() { this.transform.localPosition = this.cameraAimObject.position; if (InputManager.cameraTypeChange) { if (this.currentState == cameraStates.onPosition) { this.currentState = cameraStates.transitionState; Camera.main.transform.DOPause(); this.transform.DOLocalRotate(new Vector3(0, 0, 0), 0.5f).SetEase(Ease.InExpo); Camera.main.transform.DOLocalMove(new Vector3(-8, 150, 0), 0.5f).SetEase(Ease.InExpo); Camera.main.transform.DOLocalRotate(new Vector3(90, 270, 0), 0.5f).SetEase(Ease.InExpo).OnComplete(() => { this.currentState = cameraStates.topView; }); } else if (this.currentState == cameraStates.topView) { this.currentState = cameraStates.transitionState; this.zoomPosition = 0; Camera.main.transform.DOPause(); this.transform.DOLocalRotate(new Vector3(0, this.cataCrux.parent.localEulerAngles.y - 90, 0), 0.5f).SetEase(Ease.InExpo); Camera.main.transform.DOLocalMove(new Vector3(-8, 24, 0), 0.5f).SetEase(Ease.InExpo); Camera.main.transform.DOLocalRotate(new Vector3(90, -270, -180), 0.5f).SetEase(Ease.InExpo).OnComplete(() => { this.currentState = cameraStates.onPosition; }); } } }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { this.Exit(); } //FullScreen if (Keyboard.GetState().IsKeyDown(Keys.F)) { graphics.ToggleFullScreen(); } switch (cameraState) { case cameraStates.FreeCamera: //Updates the freecamera method freeCameraUpdate(gameTime); //Changing the cameratate to the corresponding class if (Keyboard.GetState().IsKeyDown(Keys.NumPad2)) { cameraState = cameraStates.ArcBallCamera; } if (Keyboard.GetState().IsKeyDown(Keys.NumPad3)) { cameraState = cameraStates.ChaseCamera; } if (Keyboard.GetState().IsKeyDown(Keys.NumPad4)) { cameraState = cameraStates.ChaseRotationCamera; } break; case cameraStates.ArcBallCamera: //Updates the arcballCamera method arcBallCameraUpdate(gameTime); //Changing the camerastate to the corresponding class if (Keyboard.GetState().IsKeyDown(Keys.NumPad1)) { cameraState = cameraStates.FreeCamera; } if (Keyboard.GetState().IsKeyDown(Keys.NumPad3)) { cameraState = cameraStates.ChaseCamera; } if (Keyboard.GetState().IsKeyDown(Keys.NumPad4)) { cameraState = cameraStates.ChaseRotationCamera; } break; case cameraStates.ChaseCamera: //Updates the chaseCamera method ChaseCamera(gameTime); //Updates the camera method UpdateCamera(gameTime); //Changing the cameratate to the corresponding class if (Keyboard.GetState().IsKeyDown(Keys.NumPad1)) { cameraState = cameraStates.FreeCamera; } if (Keyboard.GetState().IsKeyDown(Keys.NumPad2)) { cameraState = cameraStates.ArcBallCamera; } if (Keyboard.GetState().IsKeyDown(Keys.NumPad4)) { cameraState = cameraStates.ChaseRotationCamera; } break; case cameraStates.ChaseRotationCamera: //Updates the ChaseRotationCamera method ChaseRotationCamera(gameTime); //Updates the camera method UpdateCamera(gameTime); //Changing the camerastate to the corresponding class if (Keyboard.GetState().IsKeyDown(Keys.NumPad1)) { cameraState = cameraStates.FreeCamera; } if (Keyboard.GetState().IsKeyDown(Keys.NumPad2)) { cameraState = cameraStates.ArcBallCamera; } if (Keyboard.GetState().IsKeyDown(Keys.NumPad3)) { cameraState = cameraStates.ChaseCamera; } break; } base.Update(gameTime); }