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

@@ -5,6 +5,7 @@ import { EntityStateEnum, EventEnum } from '../../Enum'
import DataManager from '../../Global/DataManager'
import EventManager from '../../Global/EventManager'
import NetworkManager from '../../Global/NetworkManager'
import { toFixed } from '../../Utils'
import { WeaponStateMachine } from './WeaponStateMachine'
const { ccclass } = _decorator
@@ -61,16 +62,18 @@ export class WeaponManager extends EntityManager {
const directionVec2 = new Vec2(pointWorldPos.x - anchorWorldPos.x, pointWorldPos.y - anchorWorldPos.y).normalize()
NetworkManager.Instance.sendMsg(ApiMsgEnum.MsgClientSync, {
type: InputTypeEnum.WeaponShoot,
owner: this.owner,
position: {
x: pointStagePos.x,
y: pointStagePos.y
},
direction: {
x: directionVec2.x,
y: directionVec2.y
},
input: {
type: InputTypeEnum.WeaponShoot,
owner: this.owner,
position: {
x: toFixed(pointStagePos.x),
y: toFixed(pointStagePos.y),
},
direction: {
x: toFixed(directionVec2.x),
y: toFixed(directionVec2.y),
},
}
})
}
}