public override int WriteTo(byte[] Buffer, int StartIndex = 0)
        {
            int cursor = StartIndex;

            cursor += base.WriteTo(Buffer, cursor);
            cursor += WallAnimationChange.WriteTo(Buffer, cursor);

            return(cursor - StartIndex);
        }
        public override int ReadFrom(byte[] Buffer, int StartIndex = 0)
        {
            int cursor = StartIndex;

            cursor += base.ReadFrom(Buffer, cursor);

            WallAnimationChange = new WallAnimationChange(Buffer, cursor);
            cursor += WallAnimationChange.ByteLength;

            return(cursor - StartIndex);
        }
예제 #3
0
        /// <summary>
        /// Applies wall animation changes on this sidedef
        /// </summary>
        /// <param name="WallAnimationChange"></param>
        public void ApplyChange(WallAnimationChange WallAnimationChange)
        {
            // Turn off scrolling for AnimationType.NONE. For other animation
            // types, set ScrollSpeed to the original value since the server
            // won't send a changed speed.
            if (WallAnimationChange.Animation.AnimationType == AnimationType.NONE)
            {
                Flags.ScrollSpeed = TextureScrollSpeed.NONE;
            }
            else
            {
                Flags.ScrollSpeed = FlagsOrig.ScrollSpeed;
            }

            // set animation
            Animation = WallAnimationChange.Animation;

            switch (WallAnimationChange.Action)
            {
            case RoomAnimationAction.RA_NONE:
                break;

            case RoomAnimationAction.RA_PASSABLE_END:
                Flags.IsPassable = true;
                break;

            case RoomAnimationAction.RA_IMPASSABLE_END:
                Flags.IsPassable = false;
                break;

            case RoomAnimationAction.RA_INVISIBLE_END:
                Flags.IsPassable = true;
                // todo: hide normal walltexture
                // Note: don't think server ever sends RA_INVISIBLE_END?
                break;
            }

            // update additional values based on scrollspeed and raise TextureChanged
            SetLowerTexture(LowerTexture, ResourceLower);
            SetMiddleTexture(MiddleTexture, ResourceMiddle);
            SetUpperTexture(UpperTexture, ResourceUpper);
        }
 public WallAnimateMessage(ushort SideDefServerID, WallAnimationChange WallAnimationChange)
     : base(MessageTypeGameMode.WallAnimate)
 {
     this.WallAnimationChange = WallAnimationChange;
 }
 public override unsafe void ReadFrom(ref byte *Buffer)
 {
     base.ReadFrom(ref Buffer);
     WallAnimationChange = new WallAnimationChange(ref Buffer);
 }
 public override unsafe void WriteTo(ref byte *Buffer)
 {
     base.WriteTo(ref Buffer);
     WallAnimationChange.WriteTo(ref Buffer);
 }