示例#1
0
        public void PushUpdateTransform(NetworkBehaviour source, object update, byte code)
        {
            byte type = update is Vector3 ? NetworkData.Vector3Type : NetworkData.QuaternionType;

            lock (Out) {
                WriteHeader(NetworkData.UpdateTransform);
                Out.WriteLong(source.NetworkId);
                Out.WriteByte(type);
                if (type == NetworkData.Vector3Type)
                {
                    Out.WriteVector3((Vector3)update);
                }
                else if (type == NetworkData.QuaternionType)
                {
                    Out.WriteQuaternion((Quaternion)update);
                }

                if (code > 0)
                {
                    Out.WriteByte(code);
                }

                ByteBuffer copy = Out.Copy();

                if (type == NetworkData.Vector3Type)
                {
                    if (code == 1)
                    {
                        PushUpdate(PositionUpdates, source, copy);
                    }
                    else if (code == 2)
                    {
                        PushUpdate(ScaleUpdates, source, copy);
                    }
                }
                else if (type == NetworkData.QuaternionType)
                {
                    PushUpdate(RotationUpdates, source, copy);
                }

                Out.Reset();
                Out.Clear();
            }
        }
示例#2
0
 public TestOutputConsole Clear()
 {
     Out.Clear();
     Error.Clear();
     return(this);
 }