mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-23 04:23:04 +00:00
remove unused code
This commit is contained in:
parent
f82315f3ad
commit
24e1e7c27b
1 changed files with 0 additions and 117 deletions
|
@ -8,11 +8,6 @@ namespace SanAndreasUnity.Net
|
|||
{
|
||||
public Rigidbody Rigidbody { get; set; }
|
||||
|
||||
Vector3 m_lastPosition = Vector3.zero;
|
||||
Vector3 m_lastRotation = Vector3.zero;
|
||||
Vector3 m_lastVelocity = Vector3.zero;
|
||||
Vector3 m_lastAngularVelocity = Vector3.zero;
|
||||
|
||||
[SyncVar] Vector3 m_net_position = Vector3.zero;
|
||||
[SyncVar] Vector3 m_net_rotation = Vector3.zero;
|
||||
[SyncVar] Vector3 m_net_velocity = Vector3.zero;
|
||||
|
@ -77,118 +72,6 @@ namespace SanAndreasUnity.Net
|
|||
this.Rigidbody.angularVelocity = m_net_angularVelocity;
|
||||
}
|
||||
|
||||
/*
|
||||
public override void OnDeserialize(NetworkReader reader, bool initialState)
|
||||
{
|
||||
bool hasRigidBody = this.Rigidbody != null;
|
||||
|
||||
byte bitfield = reader.ReadByte();
|
||||
|
||||
//Vector3 pos = Vector3.zero;
|
||||
//Vector3 rot = Vector3.zero;
|
||||
//Vector3 vel = Vector3.zero;
|
||||
//Vector3 angVel = Vector3.zero;
|
||||
|
||||
if ((bitfield & 1) != 0)
|
||||
{
|
||||
Vector3 pos = reader.ReadVector3();
|
||||
if (hasRigidBody)
|
||||
this.Rigidbody.MovePosition(pos);
|
||||
}
|
||||
|
||||
if ((bitfield & 2) != 0)
|
||||
{
|
||||
Vector3 rot = reader.ReadVector3();
|
||||
if (hasRigidBody)
|
||||
this.Rigidbody.MoveRotation(Quaternion.Euler(rot));
|
||||
}
|
||||
|
||||
if ((bitfield & 4) != 0)
|
||||
{
|
||||
Vector3 vel = reader.ReadVector3();
|
||||
if (hasRigidBody)
|
||||
this.Rigidbody.velocity = vel;
|
||||
}
|
||||
|
||||
if ((bitfield & 8) != 0)
|
||||
{
|
||||
Vector3 angVel = reader.ReadVector3();
|
||||
if (hasRigidBody)
|
||||
this.Rigidbody.angularVelocity = angVel;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override bool OnSerialize(NetworkWriter writer, bool initialState)
|
||||
{
|
||||
if (null == this.Rigidbody)
|
||||
return false;
|
||||
|
||||
Vector3 pos = this.Rigidbody.position;
|
||||
Vector3 rot = this.Rigidbody.rotation.eulerAngles;
|
||||
Vector3 vel = this.Rigidbody.velocity;
|
||||
Vector3 angVel = this.Rigidbody.angularVelocity;
|
||||
|
||||
if (initialState)
|
||||
{
|
||||
writer.Write((byte) byte.MaxValue);
|
||||
writer.Write(pos);
|
||||
writer.Write(rot);
|
||||
writer.Write(vel);
|
||||
writer.Write(angVel);
|
||||
|
||||
m_lastPosition = pos;
|
||||
m_lastRotation = rot;
|
||||
m_lastVelocity = vel;
|
||||
m_lastAngularVelocity = angVel;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int startingWriterPosition = writer.Position;
|
||||
writer.Write((byte)0);
|
||||
|
||||
byte bitfield = 0;
|
||||
|
||||
if (pos != m_lastPosition)
|
||||
{
|
||||
m_lastPosition = pos;
|
||||
writer.Write(pos);
|
||||
bitfield |= 1;
|
||||
}
|
||||
|
||||
if (rot != m_lastRotation)
|
||||
{
|
||||
m_lastRotation = rot;
|
||||
writer.Write(rot);
|
||||
bitfield |= 2;
|
||||
}
|
||||
|
||||
if (vel != m_lastVelocity)
|
||||
{
|
||||
m_lastVelocity = vel;
|
||||
writer.Write(vel);
|
||||
bitfield |= 4;
|
||||
}
|
||||
|
||||
if (angVel != m_lastAngularVelocity)
|
||||
{
|
||||
m_lastAngularVelocity = angVel;
|
||||
writer.Write(angVel);
|
||||
bitfield |= 8;
|
||||
}
|
||||
|
||||
int endWriterPosition = writer.Position;
|
||||
|
||||
writer.Position = startingWriterPosition;
|
||||
writer.Write(bitfield);
|
||||
|
||||
writer.Position = endWriterPosition;
|
||||
|
||||
return bitfield != 0; // is dirty
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue