예제 #1
0
        private void UpdatePositionForOthers(Vector2 position)
        {
            var id = playerGameObjectGetter.GetPlayerGameObject().Id;
            var directionTransform = playerGameObjectGetter.GetPlayerGameObject().Components.GetComponent <IDirectionTransform>().AssertNotNull();
            var direction          = directionTransform.Direction.GetDirectionsFromDirection();
            var parameters         = new SceneObjectPositionChangedEventParameters(id, position.X, position.Y, direction);

            interestAreaNotifier.NotifySubscribers((byte)GameEvents.PositionChanged, parameters, MessageSendOptions.DefaultUnreliable((byte)GameDataChannels.Position));
        }
        public EmptyParameters?Handle(MessageData <UpdatePlayerStateRequestParameters> messageData, ref MessageSendOptions sendOptions)
        {
            var playerState = messageData.Parameters.PlayerState;

            var playerPositionController = sceneObject.Components.GetComponent <IPlayerPositionController>();

            if (playerPositionController != null)
            {
                playerPositionController.PlayerState = playerState;
            }

            var parameters         = new PlayerStateChangedEventParameters(playerState, sceneObject.Id);
            var messageSendOptions = MessageSendOptions.DefaultReliable((byte)GameDataChannels.Animations);

            interestAreaNotifier.NotifySubscribers((byte)GameEvents.PlayerStateChanged, parameters, messageSendOptions);
            return(null);
        }