Change send modifications
This commit is contained in:
parent
d553b72daf
commit
a8e0bac437
@ -46,12 +46,10 @@ class MultiplayerNetwork{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func sendPlayerMove(unitcount:Int) {
|
func sendPlayerMove(unitcount:Int) {
|
||||||
var playerMoveMsg = PlayerMove(messageType: MessageType.PlayerMove, unitCount: unitcount)
|
let playerMoveMsg = PlayerMove(messageType: MessageType.PlayerMove, unitCount: unitcount)
|
||||||
|
let encoder = JSONEncoder()
|
||||||
|
let encoded = (try? encoder.encode(playerMoveMsg))!
|
||||||
let data = Data(bytes: &playerMoveMsg, count: MemoryLayout<PlayerMove>.size)
|
sendData(data: encoded)
|
||||||
|
|
||||||
sendData(data: data)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user