Upload from upload_mods.ps1
This commit is contained in:
49
Scripts/Network/NetPackageUpdateVehicleHealthRebirth.cs
Normal file
49
Scripts/Network/NetPackageUpdateVehicleHealthRebirth.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user