文章分类 -  C#

摘要:using UnityEngine; namespace LazyPan { public class CloneUtil { public static T DeepClone<T>(T original) { string json = JsonUtility.ToJson(original); 阅读全文
posted @ 2024-01-17 09:56 匿鱼 阅读(5) 评论(0) 推荐(0) 编辑
摘要:using UnityEngine; public class ArrayPicker : MonoBehaviour { private int[] array = { 1, 2, 3, 4, 5 }; private int index1; private int index2; private 阅读全文
posted @ 2024-01-09 16:09 匿鱼 阅读(4) 评论(0) 推荐(0) 编辑
摘要:1、四舍五入到小数点后几位数 公式:Mathf.Round(#浮点数# * 1000f) / 1000f 说明:1000 说明四舍五入到小数点后 3 位数 2、Lerp 平滑方式 ```C# if (currentHorizontalSpeed targetSpeed + speedOffset) 阅读全文
posted @ 2023-07-02 10:27 匿鱼 阅读(262) 评论(0) 推荐(0) 编辑
摘要:static 静态 readonly 只读 (可以在声明或构造函数中初始化) const 只读(需在编译期也就是声明期初始化) 阅读全文
posted @ 2022-05-31 11:12 匿鱼 阅读(18) 评论(0) 推荐(0) 编辑
摘要:1、关于什么是抽象? 2、为什么要抽象? 比如说 你要杀死一个动物 KillAnimal() 这个方法 如果没有抽象类 你是不是要创建 类似于 KillAnimal(Cat cat) 杀死猫 KillAnimal(Dog dog) 杀死狗 然后把所有的动物列举出来。 但是用了抽象方法 Animal 阅读全文
posted @ 2022-05-19 16:26 匿鱼 阅读(20) 评论(0) 推荐(0) 编辑
摘要:String 字符串切割 IndexOf (获取索引) https://docs.microsoft.com/zh-cn/dotnet/api/system.string.indexof?view=net-6.0 SubString (从此实例检索子字符串。重载此成员。 有关此成员的完整信息(包括语 阅读全文
posted @ 2022-05-09 11:10 匿鱼 阅读(16) 评论(0) 推荐(0) 编辑
摘要:说明:Attribute 是一种自定义修饰符 和注释的区别:注释不会被编译,Attribute 会编译。 特性类必须继承 Attribute 类,且类名必须以 Attribute 名字结束。 获取方式: 单个属性使用 GetCustomAttribute 获取 多个属性使用 GetCUstomAtt 阅读全文
posted @ 2022-04-24 10:12 匿鱼 阅读(16) 评论(0) 推荐(0) 编辑
摘要:参考:https://www.cnblogs.com/tonney/archive/2011/03/19/1987577.html public void Start() { string str = ""; sbyte s1 = SByte.MaxValue; sbyte s2 = SByte.M 阅读全文
posted @ 2022-03-21 21:46 匿鱼 阅读(14) 评论(0) 推荐(0) 编辑
摘要:C# 排序 public class BaseData : MonoBehaviour { class Player { public int id; public string name; public int age; public int score; public Player() { } 阅读全文
posted @ 2022-01-17 17:20 匿鱼 阅读(36) 评论(0) 推荐(0) 编辑
摘要:参考视频: .NET/C# AOP面向切面编程之设计进阶 - YouTube 介绍:面向切面编程 是对 OOP 的补充 解决类的内部变化问题 让开发者动态修改静态的面向对象模型 在不破坏封装的情况下 ,增加各种功能:公共逻辑 - 非业务逻辑 静态 AOP 1-装饰器模式实现 AOP (组合加继承) 阅读全文
posted @ 2021-11-09 18:15 匿鱼 阅读(209) 评论(0) 推荐(0) 编辑
摘要:A 字典 1 void Start() { 2 enemyDic.Add("A",transform);//增 3 enemyDic.Add("B",transform);//增 4 5 if (enemyDic.ContainsKey("A")) {//查 6 enemyDic.Remove("A 阅读全文
posted @ 2021-08-09 12:08 匿鱼 阅读(46) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示