コード例 #1
0
ファイル: Game.go プロジェクト: toophy/go-gameserver
func OnPlayerMove(_player interfaces.IPlayer, _direction uint16) {
	basePosition := _player.GetPosition()
	retValue := internalCreatureMove(_player, _direction)
	if retValue == world.RET_NOTPOSSIBLE {
		// Send current position to client, so position is synced
		_player.Walk(basePosition, position.ZP, false, _direction)
	}
}
コード例 #2
0
func (cw *ConnectionWrapper) AssignToPlayer(_player interfaces.IPlayer) {
	if _player == nil {
		panic("ConnectionWrapper - Player interface can not be nil")
	}

	cw.player = _player
	_player.SetNetworkChans(cw.rxChan, cw.txChan)
}