AlicizaX/Client/Assets/Scripts/New/readme.md
2026-03-25 18:33:59 +08:00

13 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

先不要分析我的代码,先对我提出的要求设计一个架构。
为了避免游戏逻辑业务繁琐 Manager 满天飞 到处都是Instance引用 Update顺序不可控提出以下设计。
游戏中会存在一开始就在场景里的Manager挂载GameObject上因为这类Mono他需要对场景里的资源有引用比如InputManager这类
Manager生命周期由自己管理
第二种Manager纯C#的形式存在 不依赖Mono 所有生命周期都有顶层管理比如TimerManager 它会继承IService IService 也可以
继承Initlize 和Destory 这是必须要继承的也可以同时继承IServiceTickable 实现类似Update的功能同理Late Fixed OnGizmo
等等。Mono类的接口 可以继承IService但是不允许继承Tick 等等这种的重复生命周期的接口。
游戏内会存在比如一开始就要创建的纯C# Manager 也有启动游戏在登陆后或者进入大厅后才创建的Manager也有一开始就放在场景
里的Manager也有进入战斗场景后才会创建的CameraManager和TimelineManager等等,禁止使用依赖注入。