C#设计模式
早点退休
这个作者很懒,什么都没留下…
展开
-
状态模式
设计模式——状态模式 适用场景: 1.可以用于控制游戏加载不用的场景 public class GameLoop : MonoBehaviour { public SceneStateController controller =null; private void Awake() { DontDestroyOnLoad(this.gameObject); } // Start is called before the first fr原创 2021-01-11 13:21:46 · 58 阅读 · 0 评论 -
Head First 设计模式——策略模式(C#)
设计模式——策略模式 设计原则 1.封装变化 2.针对接口编程,而不是针对实现编程 3.多用组合,少用继承 使用策略模式写的代码 class Program { static void Main(string[] args) { Duck realDuck = new RealDuck(); realDuck.Display();//父类中放的子类,但是如果方法重写,调用的是子类的方法 .原创 2021-01-02 21:31:36 · 332 阅读 · 2 评论