75 lines
2.8 KiB
C#
75 lines
2.8 KiB
C#
public class NetPackageSpawnVehicleFromItemRebirth : NetPackage
|
|
{
|
|
public NetPackageSpawnVehicleFromItemRebirth Setup(string _className,
|
|
Vector3 _pos,
|
|
Vector3 _rot,
|
|
ItemValue _itemValue,
|
|
int _entityThatPlaced,
|
|
bool _isLocal)
|
|
{
|
|
//Log.Out("NetPackageSpawnVehicleFromItemRebirth-Setup START");
|
|
this.className = _className;
|
|
this.pos = _pos;
|
|
this.rot = _rot;
|
|
this.itemValue = _itemValue;
|
|
this.entityThatPlaced = _entityThatPlaced;
|
|
this.isLocal = _isLocal;
|
|
|
|
return this;
|
|
}
|
|
|
|
public override void read(PooledBinaryReader _reader)
|
|
{
|
|
//Log.Out("NetPackageSpawnVehicleFromItemRebirth-read START");
|
|
this.className = _reader.ReadString();
|
|
this.pos = StreamUtils.ReadVector3(_reader);
|
|
this.rot = StreamUtils.ReadVector3(_reader);
|
|
this.itemValue = new ItemValue();
|
|
this.itemValue.Read(_reader);
|
|
this.entityThatPlaced = _reader.ReadInt32();
|
|
this.isLocal = _reader.ReadBoolean();
|
|
}
|
|
|
|
public override void write(PooledBinaryWriter _writer)
|
|
{
|
|
//Log.Out("NetPackageSpawnVehicleFromItemRebirth-write START");
|
|
base.write(_writer);
|
|
_writer.Write(this.className);
|
|
StreamUtils.Write(_writer, this.pos);
|
|
StreamUtils.Write(_writer, this.rot);
|
|
this.itemValue.Write(_writer);
|
|
_writer.Write(this.entityThatPlaced);
|
|
_writer.Write(this.isLocal);
|
|
}
|
|
|
|
public override void ProcessPackage(World _world, GameManager _callbacks)
|
|
{
|
|
//Log.Out("NetPackageSpawnVehicleFromItemRebirth-ProcessPackage START");
|
|
if (_world == null)
|
|
{
|
|
return;
|
|
}
|
|
ItemValue[] itemValues = { ItemValue.None };
|
|
GameManager.Instance.StartCoroutine(RebirthUtilities.SpawnVehicleFromItemCoroutine(
|
|
this.className,
|
|
this.pos,
|
|
this.rot,
|
|
this.itemValue.Clone(),
|
|
this.entityThatPlaced,
|
|
this.isLocal
|
|
));
|
|
}
|
|
|
|
public override int GetLength()
|
|
{
|
|
return 14;
|
|
}
|
|
|
|
public string className;
|
|
public Vector3 pos;
|
|
public Vector3 rot;
|
|
public ItemValue itemValue;
|
|
public int entityThatPlaced;
|
|
public bool isLocal;
|
|
}
|