예제 #1
0
        public Message MiceChange(MiceChangeMessage message)
        {
            Player currentPlayer = _websocket.GetCurrentSessionPlayer();

            Assert.ThrowIfNull(currentPlayer, "requires a user session", _websocket);

            GameInstance gameInstance = _websocket.FindPlayerGameInstance(currentPlayer);

            if (gameInstance != null)
            {
                var outgoingMessage = new MiceChangedMessage
                {
                    Payload = message.Payload
                };

                _websocket.Broadcast(outgoingMessage, currentPlayer.GameInstanceRef, meToo: false);
            }

            return(null);
        }
예제 #2
0
    void UpdateAsHost()
    {
        Vector3 world = GetMousePoint();

        // move mouse cursor object to that position
        thisMouse.transform.position = world;

        // keep track of my mouse position in the list of mice sent to guests
        miceTracker.Track(playerId, new Vec2d {
            X = world.x, Y = world.y
        });

        // get a list of only mice that have changed position
        Mice mice = miceTracker.BuildMice();

        if (mice != null)
        {
            // send changed mice to guests
            MiceChangeMessage mcm = new MiceChangeMessage
            {
                Payload = mice
            };
            stateFluxClient.SendRequest(mcm);

            // move mouse cursor gameobjects
            foreach (Mouse m in mice.Items)
            {
                SetPlayerMouseDetails(m);
            }
        }

        if (Input.GetMouseButtonDown(0))
        {
            if (stateFluxClient.isHosting)
            {
                SendHostFloobieCommand();
            }
            ChangeTracker changeTracker = CreateJake(world, thisPlayer.Color, circler);
            gameObjectTracker.TrackCreate(changeTracker);
        }
    }