- Learning C# 7 By Developing Games with Unity 2017(Third Edition)
- Micael DaGra?a Greg Lukosek
- 154字
- 2021-07-02 19:59:38
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 that we want our game to execute more than once. For example, we can write a piece of code that adds two numbers. Suppose our game needs to add those two numbers a hundred different times during gameplay. So you'd say, "Wow! I have to write the same code a hundred times to add 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 your game needs to add two numbers, don't write the code over and over, just call the AddTwoNumbers() method.
- Vue.js設(shè)計(jì)與實(shí)現(xiàn)
- 程序員面試算法寶典
- Mastering Articulate Storyline
- Yii Project Blueprints
- Windows Embedded CE 6.0程序設(shè)計(jì)實(shí)戰(zhàn)
- C++編程兵書
- Swift語言實(shí)戰(zhàn)晉級(jí)
- 零基礎(chǔ)學(xué)Python編程(少兒趣味版)
- 網(wǎng)絡(luò)數(shù)據(jù)采集技術(shù):Java網(wǎng)絡(luò)爬蟲實(shí)戰(zhàn)
- Web Developer's Reference Guide
- 深入解析Java編譯器:源碼剖析與實(shí)例詳解
- Web前端開發(fā)技術(shù):HTML、CSS、JavaScript
- Java Web動(dòng)態(tài)網(wǎng)站開發(fā)(第2版·微課版)
- SAS編程演義
- Android開發(fā)進(jìn)階實(shí)戰(zhàn):拓展與提升