官术网_书友最值得收藏!

Chapter 5. Making Decisions in Code

One of the primary duties of a computer is controlling what happens next when certain conditions are met. That's what computers do whether the code is controlling an application or a game. We write scripts to make GameObjects behave a certain way one moment, then the behavior should change when the conditions change. A script has to detect when the conditions change, then make the appropriate code execute based on the new conditions. This chapter looks at some examples of the ways that conditions can change, and the code to detect these changes. This in turn determines which code in the script is executed next.

In this chapter we will discuss:

  • If statement decisions
  • Checking for many conditions
  • If-else statement decisions
  • User's input condition changes
  • Looping though data in an Array, List, or Dictionary

Let's begin...

主站蜘蛛池模板: 沈阳市| 奉贤区| 巍山| 蕲春县| 临澧县| 资源县| 嘉荫县| 塔城市| 天门市| 衢州市| 富川| 沙湾县| 瓦房店市| 喀什市| 周至县| 浮梁县| 景谷| 即墨市| 玉田县| 巴林左旗| 昭平县| 安西县| 通榆县| 临朐县| 衡东县| 怀柔区| 涡阳县| 冕宁县| 襄汾县| 北宁市| 东辽县| 沛县| 奉化市| 菏泽市| 册亨县| 崇礼县| 阳原县| 芷江| 澜沧| 赤水市| 兴山县|