This commit is contained in:
sli97
2022-12-03 21:28:38 +08:00
parent f3dc3ef7ba
commit a678a5b3fc
10 changed files with 76 additions and 32 deletions

View File

@@ -4,7 +4,7 @@ import { ApiMsgEnum, EntityTypeEnum, IActor, InputTypeEnum, IVec2 } from '../../
import { EntityStateEnum } from '../../Enum';
import DataManager from '../../Global/DataManager';
import NetworkManager from '../../Global/NetworkManager';
import { rad2Angle } from '../../Utils';
import { rad2Angle, toFixed } from '../../Utils';
import { WeaponManager } from '../Weapon/WeaponManager';
import { PlayerStateMachine } from './ActorStateMachine';
const { ccclass } = _decorator;
@@ -61,13 +61,15 @@ export class ActorManager extends EntityManager implements IActor {
const { x, y } = DataManager.Instance.jm.input
NetworkManager.Instance.sendMsg(ApiMsgEnum.MsgClientSync, {
type: InputTypeEnum.ActorMove,
id: this.id,
direction: {
x,
y
},
dt
input: {
type: InputTypeEnum.ActorMove,
id: this.id,
direction: {
x: toFixed(x),
y: toFixed(y),
},
dt: toFixed(dt)
}
})
}