ToChangeData() public abstract method

public abstract ToChangeData ( ) : ChangeData
return ChangeData
Esempio n. 1
0
        public override void HandleWorldChange(Change change)
        {
            // can the player see the change?
            if (!CanSeeChange(change))
            {
                return;
            }

            // Send object data for an object that comes to the environment
            if (change is ObjectMoveChange)
            {
                var c   = (ObjectMoveChange)change;
                var dst = c.Destination as EnvironmentObject;

                if (dst != null && c.Source != c.Destination &&
                    (dst.VisibilityMode == VisibilityMode.AllVisible || dst.VisibilityMode == VisibilityMode.GlobalFOV))
                {
                    var newObject = c.Object;
                    var vis       = m_player.GetObjectVisibility(newObject);
                    Debug.Assert(vis != ObjectVisibility.None);
                    newObject.SendTo(m_player, vis);
                }
            }

            // When an item is equipped by a non-controllable, the item isn't known to the client.
            // Thus we need to send the data of the item here, before sending the property change message.
            // XXX should there be some kind of "visibility-changed" event?
            if (change is PropertyChange)
            {
                var c = (PropertyChange)change;

                if (c.PropertyID == PropertyID.IsEquipped)
                {
                    var item = (ItemObject)c.Object;

                    if (item.IsEquipped)
                    {
                        var equipper = (LivingObject)item.Container;

                        if (m_player.IsController(equipper) == false)
                        {
                            item.SendTo(m_player, ObjectVisibility.Public);
                        }
                    }
                }
            }

            var changeMsg = new ChangeMessage()
            {
                ChangeData = change.ToChangeData()
            };

            Send(changeMsg);
        }
Esempio n. 2
0
        public override void HandleWorldChange(Change change)
        {
            var changeMsg = new ChangeMessage() { ChangeData = change.ToChangeData() };

            Send(changeMsg);

            if (change is ObjectCreatedChange)
            {
                var c = (ObjectCreatedChange)change;
                var newObject = c.Object;
                newObject.SendTo(m_player, ObjectVisibility.All);
            }
        }
Esempio n. 3
0
        public override void HandleWorldChange(Change change)
        {
            var changeMsg = new ChangeMessage()
            {
                ChangeData = change.ToChangeData()
            };

            Send(changeMsg);

            if (change is ObjectCreatedChange)
            {
                var c         = (ObjectCreatedChange)change;
                var newObject = c.Object;
                newObject.SendTo(m_player, ObjectVisibility.All);
            }
        }
Esempio n. 4
0
        public override void HandleWorldChange(Change change)
        {
            // can the player see the change?
            if (!CanSeeChange(change))
                return;

            // Send object data for an object that comes to the environment
            if (change is ObjectMoveChange)
            {
                var c = (ObjectMoveChange)change;
                var dst = c.Destination as EnvironmentObject;

                if (dst != null && c.Source != c.Destination &&
                    (dst.VisibilityMode == VisibilityMode.AllVisible || dst.VisibilityMode == VisibilityMode.GlobalFOV))
                {
                    var newObject = c.Object;
                    var vis = m_player.GetObjectVisibility(newObject);
                    Debug.Assert(vis != ObjectVisibility.None);
                    newObject.SendTo(m_player, vis);
                }
            }

            // When an item is equipped by a non-controllable, the item isn't known to the client.
            // Thus we need to send the data of the item here, before sending the property change message.
            // XXX should there be some kind of "visibility-changed" event?
            if (change is PropertyChange)
            {
                var c = (PropertyChange)change;

                if (c.PropertyID == PropertyID.IsEquipped)
                {
                    var item = (ItemObject)c.Object;

                    if (item.IsEquipped)
                    {
                        var equipper = (LivingObject)item.Container;

                        if (m_player.IsController(equipper) == false)
                            item.SendTo(m_player, ObjectVisibility.Public);
                    }
                }
            }

            var changeMsg = new ChangeMessage() { ChangeData = change.ToChangeData() };

            Send(changeMsg);
        }