Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class movw : MonoBehaviour
- {
- private float speed_x;
- private float speed_y;
- private float angle;
- private float speed_angle;
- private float speed_fall;
- private bool up;
- private bool down;
- private Quaternion StartRotation = Quaternion.AngleAxis(0f, new Vector3(1f, 1f, 1f));
- void Start()
- {
- this.speed_x = 0f;
- this.speed_y = 0.1f;
- this.speed_angle = 2f;
- this.speed_fall = 1f;
- this.angle = 0f;
- }
- public void Bberx(){
- if (PlayerPrefs.GetInt("esc") == 0){
- if (base.transform.position.y < 5f){
- if (this.angle < 30f)
- {
- this.angle += this.speed_angle;
- Quaternion rhs = Quaternion.AngleAxis(this.angle, new Vector3(0f, 0f, 1f));
- base.transform.rotation = this.StartRotation * rhs;
- }
- this.up = true;
- }
- }
- }
- public void Bnip(){
- if (PlayerPrefs.GetInt("esc") == 0){
- if (base.transform.position.y > -5f){
- if (this.angle > -30f)
- {
- this.angle -= this.speed_angle;
- Quaternion rhs = Quaternion.AngleAxis(this.angle, new Vector3(0f, 0f, 1f));
- base.transform.rotation = this.StartRotation * rhs;
- }
- this.down = true;
- }
- }
- }
- private void FixedUpdate()
- {
- if (PlayerPrefs.GetInt("esc") == 0)
- {
- this.up = false;
- this.down = false;
- if (!this.up && this.angle > 0f)
- {
- this.angle -= this.speed_fall;
- }
- if (!this.down && this.angle < 0f)
- {
- this.angle += this.speed_fall;
- }
- if (base.transform.position.y < 5f && this.angle > 0f)
- {
- base.transform.Translate(0f, this.speed_y * this.angle, 0f);
- }
- if (base.transform.position.y > -5f && this.angle < 0f)
- {
- base.transform.Translate(0f, this.speed_y * this.angle, 0f);
- }
- base.transform.Translate(this.speed_x, 0f, 0f);
- PlayerPrefs.SetInt("Score", (int)base.transform.position.x);
- }
- if (PlayerPrefs.GetInt("esc") == 0)
- {
- this.up = false;
- this.down = false;
- if (base.transform.position.y >= 4.9f)
- {
- if (this.angle > 0f)
- {
- this.angle -= this.speed_fall;
- Quaternion rhs = Quaternion.AngleAxis(this.angle, new Vector3(0f, 0f, 1f));
- base.transform.rotation = this.StartRotation * rhs;
- }
- if (this.angle > 0f)
- {
- this.angle -= this.speed_fall;
- Quaternion rhs = Quaternion.AngleAxis(this.angle, new Vector3(0f, 0f, 1f));
- base.transform.rotation = this.StartRotation * rhs;
- }
- if (this.angle > 0f)
- {
- this.angle -= this.speed_fall;
- Quaternion rhs = Quaternion.AngleAxis(this.angle, new Vector3(0f, 0f, 1f));
- base.transform.rotation = this.StartRotation * rhs;
- }
- if (this.angle > 0f)
- {
- this.angle -= this.speed_fall;
- Quaternion rhs = Quaternion.AngleAxis(this.angle, new Vector3(0f, 0f, 1f));
- base.transform.rotation = this.StartRotation * rhs;
- }
- }
- if (base.transform.position.y <= -4.9f)
- {
- if (this.angle < 0f)
- {
- this.angle += this.speed_fall;
- Quaternion rhs = Quaternion.AngleAxis(this.angle, new Vector3(0f, 0f, 1f));
- base.transform.rotation = this.StartRotation * rhs;
- }
- if (this.angle < 0f)
- {
- this.angle += this.speed_fall;
- Quaternion rhs = Quaternion.AngleAxis(this.angle, new Vector3(0f, 0f, 1f));
- base.transform.rotation = this.StartRotation * rhs;
- }
- if (this.angle < 0f)
- {
- this.angle += this.speed_fall;
- Quaternion rhs = Quaternion.AngleAxis(this.angle, new Vector3(0f, 0f, 1f));
- base.transform.rotation = this.StartRotation * rhs;
- }
- if (this.angle < 0f)
- {
- this.angle += this.speed_fall;
- Quaternion rhs = Quaternion.AngleAxis(this.angle, new Vector3(0f, 0f, 1f));
- base.transform.rotation = this.StartRotation * rhs;
- }
- }
- if (!this.up && this.angle > 0f)
- {
- this.angle -= this.speed_fall;
- Quaternion rhs = Quaternion.AngleAxis(this.angle, new Vector3(0f, 0f, 1f));
- base.transform.rotation = this.StartRotation * rhs;
- }
- if (!this.down && this.angle < 0f)
- {
- this.angle += this.speed_fall;
- Quaternion rhs = Quaternion.AngleAxis(this.angle, new Vector3(0f, 0f, 1f));
- base.transform.rotation = this.StartRotation * rhs;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement