コード例 #1
0
        private void UpdateActorPos()
        {
            UpdateActorPos output = new UpdateActorPos()
            {
                RoomId      = RoomId,
                OwnerId     = OwnerId,
                ActorId     = ActorId,
                PosX        = PosX,
                PosZ        = PosZ,
                CellIndex   = CellIndex,
                Orientation = Orientation,
            };

            GameRoomManager.Instance.SendMsg(ROOM.UpdateActorPos, output.ToByteArray());
        }
コード例 #2
0
    private void OnUpdateActorPos(SocketAsyncEventArgs args, byte[] bytes)
    {
        UpdateActorPos input = UpdateActorPos.Parser.ParseFrom(bytes);

        if (input.RoomId != RoomId)
        {
            return; // 不是自己房间的消息,略过
        }
        if (input.CellIndex == 0)
        {
            Debug.LogError("RoomLogic OnUpdateActorPos Error - Actor position is lost!");
        }
        var ab = ActorManager.GetActor(input.ActorId);

        if (ab != null)
        {
            ab.PosX        = input.PosX;
            ab.PosZ        = input.PosZ;
            ab.CellIndex   = input.CellIndex;
            ab.Orientation = input.Orientation;
        }

        // 这个消息不用返回了
    }