for(){}
for(int i=1,i<=10,i++){}
for(){}
for(int i=1,i<=10,i++){}
int【】hps={1,2,3,4};
print(hps【3】);
int【】hps=new int【10】;
int【】hps=new int【3】{1,2,3};
数组:类型【】数组名={数组值}
int【】hps={10,13,14,14,143}数组长度5
通过索引访问数据 数组名【索引】
索引从0开始
hp+=110;
两个数相除,小数部分会自动舍去
多个数据类型相加,返回结果是数据类型大的
int hp=100;整数型
float mp=3.4f;浮点型
bool isdie=true;布尔型
char c='c';字符型
string name="hahha "字符串型
ctrl+k,ctrl+c多行注释.
变量不可以用数字开头.
int hp=100;
print(hp);
unity:
if( )
{
}
void start(){
}
游戏物体的获取
禁用的脚本中的public 方法也可以使用
foreach
主要用来遍历