74 lines
2.4 KiB
C#
74 lines
2.4 KiB
C#
public class NetPackageRebirthUtilitiesReborn : NetPackage
|
|
{
|
|
public NetPackageRebirthUtilitiesReborn Setup(int _entityID,
|
|
int _classID,
|
|
int numReborn,
|
|
int _eventSpawn,
|
|
float _numStartScale
|
|
)
|
|
{
|
|
//Log.Out("NetPackageRebirthUtilitiesReborn-Setup START");
|
|
this.entityID = _entityID;
|
|
this.classID = _classID;
|
|
this.numReborn = numReborn;
|
|
this.eventSpawn = _eventSpawn;
|
|
this.numStartScale = _numStartScale;
|
|
|
|
return this;
|
|
}
|
|
|
|
public override void read(PooledBinaryReader _reader)
|
|
{
|
|
//Log.Out("NetPackageRebirthUtilitiesReborn-read START");
|
|
this.entityID = _reader.ReadInt32();
|
|
this.classID = _reader.ReadInt32();
|
|
this.numReborn = _reader.ReadInt32();
|
|
this.eventSpawn = _reader.ReadInt32();
|
|
this.numStartScale = _reader.ReadSingle();
|
|
}
|
|
|
|
public override void write(PooledBinaryWriter _writer)
|
|
{
|
|
//Log.Out("NetPackageRebirthUtilitiesReborn-write START");
|
|
base.write(_writer);
|
|
_writer.Write(this.entityID);
|
|
_writer.Write(this.classID);
|
|
_writer.Write(this.numReborn);
|
|
_writer.Write(this.eventSpawn);
|
|
_writer.Write(this.numStartScale);
|
|
}
|
|
|
|
public override void ProcessPackage(World _world, GameManager _callbacks)
|
|
{
|
|
//Log.Out("NetPackageRebirthUtilitiesReborn-ProcessPackage START");
|
|
if (_world == null)
|
|
{
|
|
//Log.Out("NetPackageRebirthUtilitiesReborn-ProcessPackage WORLD == null");
|
|
return;
|
|
}
|
|
|
|
Entity entity = GameManager.Instance.World.GetEntity(this.entityID);
|
|
|
|
if (entity is EntityAlive entityAlive)
|
|
{
|
|
//Log.Out("NetPackageRebirthUtilitiesReborn-ProcessPackage numReborn: " + numReborn);
|
|
|
|
entityAlive.MarkToUnload();
|
|
entityAlive.KillLootContainer();
|
|
|
|
RebirthUtilities.SpawnRebornZombie(entityAlive, classID, entityAlive.position, entityAlive.rotation, numReborn, eventSpawn, numStartScale);
|
|
}
|
|
}
|
|
|
|
public override int GetLength()
|
|
{
|
|
return 8;
|
|
}
|
|
|
|
private int entityID;
|
|
private int classID;
|
|
private int numReborn;
|
|
private int eventSpawn;
|
|
private float numStartScale;
|
|
}
|