文章首发及后续更新:https://mwhls.top/4439.html,无图/无目录/格式错误/更多相关请至首发页查看。
新的更新内容请到mwhls.top查看。
欢迎提出任何疑问及批评,非常感谢!
目录 安装 开启第一个项目 C 数 字符串 变量 逻辑运算 条件语句 循环 函数 数组汇总:Unity 记录
写的很简略,因为不是写教程,是学习记录,其中大部分东西对我来说按经验去做就行,所以不像写项目那样详细。中英文也是这样,英文太长了,我就换成中文,不过我的翻译可能是错的或是有歧义的。
绝绝子,我博客的代码渲染居然不包括 C#
参考课程:最新 Unity和C#2D游戏开发实战全流程教程 [中文字幕|超新实战课程]
Could not locate MSBuild instance to register with OmniSharp.
C# extension插件回到1.24.4,可以类的补全,上面那个不够,参考:https://t.bilibili.com/666257188394631238整型:`1`
浮点型:`1f`
"h"
"hello"
数组:"hello"[0] == "h"
子字符串:"hello".substring(2, 3) == "llo"
长度:"hello".Length
- 为什么要用大写?
连接:"a"+"b" == "ab"
类型转换:1.0f.ToString()
int, float, string, bool
string aString = "mwhls.top";
public string aString = "mwhls.top";
public 修饰 的变量可以在对象的检查器中修改。
public 修饰的变量放在方法里会报错,在类中和方法同级时不会报错。
bool isDead = False;
&&, ||, !=, >=, >
if (x < 0){print("<0");
} else if (x == 0){print("=0");
} else{print(">0");
}
while(x < 0){print(x);x += 1;
}
for (int x = -1; x <= 0; x += 1){
print(x);
}
bool is_negative(int x){if(x < 0){return true;} else{return false;}
}
string[] websites = new string[] {"mwhls.top", "panwj.top"};
int[] number = new int[3];
上一篇:学术论文插图要求简介
下一篇:curl技术篇