GiveBoostIfMovingOnXorYAxis
How do I use Give Boost If Moving On Xor Y Axis
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
21 | GiveBoostIfMovingOnXorYAxis(); | 1 |
24 | private void GiveBoostIfMovingOnXorYAxis() | 2 |
File name: BallScript.cs
Copy
18 void Update()
19 {
20 if (GameManager.CurrentGameState == GameManager.GameState.Playing)
21 GiveBoostIfMovingOnXorYAxis();
22 }
File name: BallScript.cs
Copy
24 private void GiveBoostIfMovingOnXorYAxis()
25 {
26 if (Mathf.Abs(GetComponent
27 {
28 //left or right?
29 bool right = Random.Range(-1.0f, 1.0f) >= 0;
30 GetComponent
31 }
32
33 if (Mathf.Abs(GetComponent
34 {
35 //up or down?
36 bool down = Random.Range(-1.0f, 1.0f) >= 0;
37 GetComponent
38 }
39 }
GiveBoostIfMovingOnXorYAxis 136 lượt xem
Gõ tìm kiếm nhanh...