添加玩家逻辑
每位玩家的状态
Player :: class : Player_Base {
health: int;
inventory_open: bool;
}服务器 + 客户端:什么在何处运行?
Player :: class : Player_Base {
ao_late_update :: method(dt: float) {
// 游戏玩法界面 + 输入处理(服务器 + 本地客户端)
if is_local_or_server() {
// draw_ability_button(this, Shoot_Ability, 0);
// 处理会改变游戏状态的点击/按压
}
// 仅装饰性的界面(仅本地客户端)
if is_local() {
// UI.text(..., "正在等待主机...");
// 粒子、屏幕震动等。
}
}
}玩家身份和资料数据
持久化:将玩家进度存储在哪里
常见模式:在加载时读取已保存的值 尤其是
尤其是最佳实践
Player_Base 参考
最后更新于