类里面
class Enemy()
{
public string name;
public int hp;
}
访问:
Enemy enemy1 = new Enemy();
类里面
class Enemy()
{
public string name;
public int hp;
}
访问:
Enemy enemy1 = new Enemy();
bool表示是和否
/定义方法 void Test(){
print("Test方法被调用了");
0
void CreateEnemy() {
print("创建敌人");
print("设置敌人位置");
print("设置敌人的初始属性");
//for循环
//print("创建了一个敌人");
//for(int i = 1; i <= 10; i++){
// /1 循环体
// print("创建了一个敌人"+i);
//}
//for(int i = 1; i <= 100; i++){
// print("创建敌人");
/1}
//for(int i = @;i<10;i++){
// print("创建敌人”);
//for循环
//print("创建了一个敌人");
//for(int i = 1; i <= 10; i++){
// /1 循环体
// print("创建了一个敌人"+i);
//}
//for(int i = 1; i <= 100; i++){
// print("创建敌人");
/1}
//for(int i = @;i<10;i++){
// print("创建敌人”);
11}
int[] hps = new int[5]{34,2,324,3,2};
int[] hps = {100,20,80,90,30};//长度为5
//通过索引值来访问数据 数组名【索引值】
print(hps[1]);//20
print(hps[4]);//30
int hp = 90;
if(hp<=0)
{
print("播放死亡动画");
}
else
{
print("播放行走动画");
}
//比较运算符
//> < <= >= == !=
//int hp = 100;
//boll res = hp>0;
//print(res);
int hp = 100;
//hp = hp +10;
//hp += 10;
//print(hp);
//hp -=100;//hp = hp-100;
//print(hp);
public GameObject cemeraMain;
public Camera mainCamer;
void Start()
{
//print(transform.Find("GameObject(1)/GameObject2"));
//print(transform.Find("GameObject(2)"));
//GameObject mainCameraGo = GameObject.Find("Main Camera");
//print(maincamera):
GameObject Player = GameObject.FindWithTag("Player"):
print(Player);
}
int ADD(int a,int b){ int res = a+b; return res; } print(res)
int i = 0;
格式:
int a = 90 ;
int b = 10 ;
int res = a+b
bool布尔类型 a = false or true;
char字符类型 a = 'XXX'
string a = "XXX"(可中文)
网址:www.cnblogsf.com/tonney/archive/2011/03/18/1987577.html
<30000 sbyte
<20000000 short
>20000000 int
float小数
写法:
(1)
int a;
a=100;
a=b
(2)
int a =100;
a=b
print(b)
日志输出: Debug.log("XXX");(警告)
Debug.logError("XXX");(严重)
print("XXX");(普通
int[] hps = new int[8]{2,2,3,4,1,2,3,4}
console.Win