SHOW:
|
|
- or go back to the newest paste.
1 | using System.Collections; | |
2 | using System.Collections.Generic; | |
3 | using UnityEngine; | |
4 | ||
5 | public class movw : MonoBehaviour | |
6 | { | |
7 | private float speed_x; | |
8 | private float speed_y; | |
9 | private float angle; | |
10 | private float speed_angle; | |
11 | private float speed_fall; | |
12 | private bool up; | |
13 | private bool down; | |
14 | private Quaternion StartRotation = Quaternion.AngleAxis(0f, new Vector3(1f, 1f, 1f)); | |
15 | ||
16 | void Start() | |
17 | { | |
18 | this.speed_x = 0f; | |
19 | this.speed_y = 0.1f; | |
20 | this.speed_angle = 2f; | |
21 | this.speed_fall = 1f; | |
22 | this.angle = 0f; | |
23 | } | |
24 | ||
25 | public void Bberx(){ | |
26 | if (PlayerPrefs.GetInt("esc") == 0){ | |
27 | if (base.transform.position.y < 5f){ | |
28 | if (this.angle < 30f) | |
29 | { | |
30 | this.angle += this.speed_angle; | |
31 | Quaternion rhs = Quaternion.AngleAxis(this.angle, new Vector3(0f, 0f, 1f)); | |
32 | base.transform.rotation = this.StartRotation * rhs; | |
33 | } | |
34 | this.up = true; | |
35 | } | |
36 | } | |
37 | } | |
38 | ||
39 | public void Bnip(){ | |
40 | if (PlayerPrefs.GetInt("esc") == 0){ | |
41 | if (base.transform.position.y > -5f){ | |
42 | if (this.angle > -30f) | |
43 | { | |
44 | this.angle -= this.speed_angle; | |
45 | Quaternion rhs = Quaternion.AngleAxis(this.angle, new Vector3(0f, 0f, 1f)); | |
46 | base.transform.rotation = this.StartRotation * rhs; | |
47 | } | |
48 | this.down = true; | |
49 | } | |
50 | } | |
51 | } | |
52 | ||
53 | private void FixedUpdate() | |
54 | { | |
55 | ||
56 | if (PlayerPrefs.GetInt("esc") == 0) | |
57 | { | |
58 | this.up = false; | |
59 | this.down = false; | |
60 | if (!this.up && this.angle > 0f) | |
61 | { | |
62 | this.angle -= this.speed_fall; | |
63 | } | |
64 | if (!this.down && this.angle < 0f) | |
65 | { | |
66 | this.angle += this.speed_fall; | |
67 | } | |
68 | if (base.transform.position.y < 5f && this.angle > 0f) | |
69 | { | |
70 | base.transform.Translate(0f, this.speed_y * this.angle, 0f); | |
71 | } | |
72 | if (base.transform.position.y > -5f && this.angle < 0f) | |
73 | { | |
74 | base.transform.Translate(0f, this.speed_y * this.angle, 0f); | |
75 | } | |
76 | base.transform.Translate(this.speed_x, 0f, 0f); | |
77 | PlayerPrefs.SetInt("Score", (int)base.transform.position.x); | |
78 | } | |
79 | ||
80 | if (PlayerPrefs.GetInt("esc") == 0) | |
81 | { | |
82 | this.up = false; | |
83 | this.down = false; | |
84 | if (base.transform.position.y >= 4.9f) | |
85 | { | |
86 | if (this.angle > 0f) | |
87 | { | |
88 | this.angle -= this.speed_fall; | |
89 | Quaternion rhs = Quaternion.AngleAxis(this.angle, new Vector3(0f, 0f, 1f)); | |
90 | base.transform.rotation = this.StartRotation * rhs; | |
91 | } | |
92 | if (this.angle > 0f) | |
93 | { | |
94 | this.angle -= this.speed_fall; | |
95 | Quaternion rhs = Quaternion.AngleAxis(this.angle, new Vector3(0f, 0f, 1f)); | |
96 | base.transform.rotation = this.StartRotation * rhs; | |
97 | } | |
98 | if (this.angle > 0f) | |
99 | { | |
100 | this.angle -= this.speed_fall; | |
101 | Quaternion rhs = Quaternion.AngleAxis(this.angle, new Vector3(0f, 0f, 1f)); | |
102 | base.transform.rotation = this.StartRotation * rhs; | |
103 | } | |
104 | if (this.angle > 0f) | |
105 | { | |
106 | this.angle -= this.speed_fall; | |
107 | Quaternion rhs = Quaternion.AngleAxis(this.angle, new Vector3(0f, 0f, 1f)); | |
108 | base.transform.rotation = this.StartRotation * rhs; | |
109 | } | |
110 | } | |
111 | if (base.transform.position.y <= -4.9f) | |
112 | { | |
113 | if (this.angle < 0f) | |
114 | { | |
115 | this.angle += this.speed_fall; | |
116 | Quaternion rhs = Quaternion.AngleAxis(this.angle, new Vector3(0f, 0f, 1f)); | |
117 | base.transform.rotation = this.StartRotation * rhs; | |
118 | } | |
119 | if (this.angle < 0f) | |
120 | { | |
121 | this.angle += this.speed_fall; | |
122 | Quaternion rhs = Quaternion.AngleAxis(this.angle, new Vector3(0f, 0f, 1f)); | |
123 | base.transform.rotation = this.StartRotation * rhs; | |
124 | } | |
125 | if (this.angle < 0f) | |
126 | { | |
127 | this.angle += this.speed_fall; | |
128 | Quaternion rhs = Quaternion.AngleAxis(this.angle, new Vector3(0f, 0f, 1f)); | |
129 | base.transform.rotation = this.StartRotation * rhs; | |
130 | } | |
131 | if (this.angle < 0f) | |
132 | { | |
133 | this.angle += this.speed_fall; | |
134 | Quaternion rhs = Quaternion.AngleAxis(this.angle, new Vector3(0f, 0f, 1f)); | |
135 | base.transform.rotation = this.StartRotation * rhs; | |
136 | } | |
137 | } | |
138 | if (!this.up && this.angle > 0f) | |
139 | { | |
140 | this.angle -= this.speed_fall; | |
141 | Quaternion rhs = Quaternion.AngleAxis(this.angle, new Vector3(0f, 0f, 1f)); | |
142 | base.transform.rotation = this.StartRotation * rhs; | |
143 | } | |
144 | if (!this.down && this.angle < 0f) | |
145 | { | |
146 | this.angle += this.speed_fall; | |
147 | Quaternion rhs = Quaternion.AngleAxis(this.angle, new Vector3(0f, 0f, 1f)); | |
148 | base.transform.rotation = this.StartRotation * rhs; | |
149 | } | |
150 | } | |
151 | } | |
152 | } | |
153 |