摘要: public class Lesson7 : MonoBehaviour { // Start is called before the first frame update void Start() { #region 角度 //相对世界坐标角度 print(transform.eulerAngl 阅读全文
posted @ 2025-03-15 20:55 cannedmint 阅读(10) 评论(0) 推荐(0)
摘要: public class Lesson6 : MonoBehaviour { // Start is called before the first frame update void Start() { #region Vector3 //Vector3主要是用来表示三维坐标系中的一个点或一个向量 阅读全文
posted @ 2025-03-15 19:51 cannedmint 阅读(30) 评论(0) 推荐(0)
摘要: public class Lesson5 : MonoBehaviour { // Start is called before the first frame update void Start() { //时间相关内容主要用于游戏中参与位移,计时,时间暂停等 #region 时间缩放比例 //时 阅读全文
posted @ 2025-03-15 17:34 cannedmint 阅读(23) 评论(0) 推荐(0)
摘要: public class GameObj : MonoBehaviour { //准备用来克隆的对象 //可以是场景上的对象,也可以是预设体对象 public GameObject obj4; // Start is called before the first frame update void 阅读全文
posted @ 2025-03-15 16:51 cannedmint 阅读(9) 评论(0) 推荐(0)
摘要: public class MonoIm : MonoBehaviour { public MonoIm otherMono; // Start is called before the first frame update void Start() { #region 重要成员 //获取依附的Gam 阅读全文
posted @ 2025-03-15 13:48 cannedmint 阅读(15) 评论(0) 推荐(0)
摘要: [System.Serializable] public class MyClass { public int id; public string name; } public class Inspector : MonoBehaviour { //Inspector窗口中可编辑的就是脚本的成员变量 阅读全文
posted @ 2025-03-15 12:13 cannedmint 阅读(9) 评论(0) 推荐(0)
摘要: 生命周期函数 生命周期函数就是该脚本对象依附的GameObject对象从出生到消亡整个生命周期中会通过反射自动调用的一些特殊函数 生命周期函数的访问修饰符一般为private和protected public class LifePeriod : MonoBehaviour { //当对象(自己这个 阅读全文
posted @ 2025-03-15 11:02 cannedmint 阅读(35) 评论(0) 推荐(0)
摘要: 迭代器 迭代器是程序设计的软件设计模式 迭代器模式提供一个方法顺序访问一个聚合对象中的各个元素而不暴露其内部的标识 在表现效果上看是可以在容器对象上遍历访问的接口 设计人员无需关心容易对象内存分配的实现细节 可以用foreach遍历的类都是实现了迭代器的 标准迭代器的实现方法 //关键接口:IEnu 阅读全文
posted @ 2025-03-14 20:47 cannedmint 阅读(52) 评论(0) 推荐(0)
摘要: 特性 特性是一种允许我们向程序的程序集添加元数据的语言结构 特性本质是一个类,可以利用特性类为元数据添加额外信息 自定义特性 //继承特性基类 class MyCustomAttribute : Attribute { //特性中的成员,一般根据需求来写 public string info; pu 阅读全文
posted @ 2025-03-14 19:55 cannedmint 阅读(6) 评论(0) 推荐(0)
摘要: Activator 用于快速实例化对象的类 用于将Type对象快捷实例化为对象 先得到Type然后快速实例化一个对象 //无参构造函数 Type testType = typeof(Test); Test testObj =Activator.CreateInstance(testType) as 阅读全文
posted @ 2025-03-14 18:15 cannedmint 阅读(11) 评论(0) 推荐(0)