- Learning C# by Developing Games with Unity 3D Beginner's Guide
- Terry Norton
- 182字
- 2021-08-04 10:03:59
Using a method in a script
Methods are where the action is and where the tasks are performed. Great, that's really nice to know but what is a method?
What is a method?
When we write a script, we are making lines of code that the computer is going to execute, one line at a time. As we write our code, there will be things we want our game to execute more than once. For example, we can write a code that adds two numbers. Suppose our game needs to add the two numbers together a hundred different times during the game. So you say, "Wow, I have to write the same code a hundred times that adds two numbers together. There has to be a better way."
Let a method take away your typing pain. You just have to write the code to add two numbers once, and then give this chunk of code a name, such as AddTwoNumbers()
. Now, every time our game needs to add two numbers, don't write the code over and over, just call the AddTwoNumbers()
method.
- Learning Cython Programming(Second Edition)
- 數據結構和算法基礎(Java語言實現)
- Python語言程序設計
- TypeScript圖形渲染實戰:基于WebGL的3D架構與實現
- Building an RPG with Unity 2018
- C語言程序設計同步訓練與上機指導(第三版)
- 計算機應用基礎實踐教程
- Java語言程序設計教程
- Swift High Performance
- Building UIs with Wijmo
- 城市信息模型平臺頂層設計與實踐
- C++ Data Structures and Algorithm Design Principles
- Lync Server Cookbook
- Qt編程快速入門
- Implementing NetScaler VPX?(Second Edition)