项目需求:

一。用一套统一的Command来驱动游戏的所有操作,Ui,Agent。。。

二。支持Keyboard,Xbox360,(可以考虑后期假如Mouse,Touch等)

首先来看看成品是怎么样的

InputCommandSytem输入指令系统(支持XBox360,Keyboard..)

再来看看

一。架构

InputCommandSytem输入指令系统(支持XBox360,Keyboard..)

二。输入收集

InputCommandSytem输入指令系统(支持XBox360,Keyboard..)

三。输入指令映射

InputCommandSytem输入指令系统(支持XBox360,Keyboard..)

四。指令分发

InputCommandSytem输入指令系统(支持XBox360,Keyboard..)

总体的思想是:

一。性能上的考虑,因为每帧都会调用这个系统来获得对应的Command驱动游戏,所以为了减少gc,在整个系统中采用了定长的Array,每次变更数据只是更改Array里的数据,不做任何的new,以及任何List增减

一。监听部分,keyboard的监听由代码实现(),而XBox的监听采用Unity原生的InputManager。然后根据InputCommandMaping来获得对应Command数组

 

相关文章:

  • 2021-05-27
  • 2021-07-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-28
  • 2021-11-11
  • 2021-12-29
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案