50 lines
1.5 KiB
C#
50 lines
1.5 KiB
C#
using UnityEngine.Scripting;
|
|
|
|
[Preserve]
|
|
public class NetPackageUpdateVehicleHealthRebirth : NetPackage
|
|
{
|
|
public NetPackageUpdateVehicleHealthRebirth Setup(int _vehicleEntityID, int _health)
|
|
{
|
|
this.vehicleHealth = _health;
|
|
this.vehicleEntityID = _vehicleEntityID;
|
|
return this;
|
|
}
|
|
|
|
public override void read(PooledBinaryReader _reader)
|
|
{
|
|
this.vehicleHealth = _reader.ReadInt32();
|
|
this.vehicleEntityID = _reader.ReadInt32();
|
|
}
|
|
|
|
public override void write(PooledBinaryWriter _writer)
|
|
{
|
|
base.write(_writer);
|
|
_writer.Write(this.vehicleHealth);
|
|
_writer.Write(this.vehicleEntityID);
|
|
}
|
|
|
|
public override void ProcessPackage(World _world, GameManager _callbacks)
|
|
{
|
|
//Log.Out("NetPackageUpdateVehicleHealthRebirth-ProcessPackage this.vehicleEntityID: " + this.vehicleEntityID);
|
|
|
|
EntityAlive entityVehicle = _world.GetEntity(this.vehicleEntityID) as EntityAlive;
|
|
if (entityVehicle == null)
|
|
{
|
|
//Log.Out("NetPackageUpdateVehicleHealthRebirth-ProcessPackage 1");
|
|
return;
|
|
}
|
|
entityVehicle.Health = this.vehicleHealth;
|
|
entityVehicle.Stats.Health.Value = this.vehicleHealth;
|
|
|
|
//Log.Out("NetPackageUpdateVehicleHealthRebirth-ProcessPackage entityVehicle.Health: " + entityVehicle.Health);
|
|
}
|
|
|
|
public override int GetLength()
|
|
{
|
|
return 4;
|
|
}
|
|
|
|
private int vehicleHealth;
|
|
private int vehicleEntityID;
|
|
}
|