您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
36 行
982 B
36 行
982 B
using System;
|
|
using UnityEngine;
|
|
|
|
public class DamageHistory : MonoBehaviour, INetworkSerializable
|
|
{
|
|
[System.Serializable]
|
|
public struct InflictedDamage
|
|
{
|
|
public int tick;
|
|
public bool lethal;
|
|
|
|
public void Serialize(ref NetworkWriter writer)
|
|
{
|
|
writer.WriteInt32("tick", tick);
|
|
writer.WriteBoolean("lethal", lethal);
|
|
}
|
|
|
|
public void Deserialize(ref NetworkReader reader, int tick)
|
|
{
|
|
this.tick = reader.ReadInt32();
|
|
lethal = reader.ReadBoolean();
|
|
}
|
|
}
|
|
|
|
[NonSerialized] public InflictedDamage inflictedDamage;
|
|
|
|
public void Serialize(ref NetworkWriter writer, IEntityReferenceSerializer refSerializer)
|
|
{
|
|
inflictedDamage.Serialize(ref writer);
|
|
}
|
|
|
|
public void Deserialize(ref NetworkReader reader, IEntityReferenceSerializer refSerializer, int tick)
|
|
{
|
|
inflictedDamage.Deserialize(ref reader, tick);
|
|
}
|
|
}
|