您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
28 行
822 B
28 行
822 B
using System;
|
|
using UnityEngine;
|
|
using Unity.Entities;
|
|
|
|
public class CharacterItem : MonoBehaviour, INetworkSerializable
|
|
{
|
|
public GameObject geomery;
|
|
|
|
[NonSerialized] public Entity character;
|
|
[NonSerialized] public bool visible;
|
|
|
|
public void SetVisible(bool visible)
|
|
{
|
|
this.visible = visible;
|
|
if(geomery != null && geomery.activeSelf != visible)
|
|
geomery.SetActive(visible);
|
|
}
|
|
|
|
public void Serialize(ref NetworkWriter writer, IEntityReferenceSerializer refSerializer)
|
|
{
|
|
refSerializer.SerializeReference(ref writer, "character", character);
|
|
}
|
|
|
|
public void Deserialize(ref NetworkReader reader, IEntityReferenceSerializer refSerializer, int tick)
|
|
{
|
|
refSerializer.DeserializeReference(ref reader, ref character);
|
|
}
|
|
}
|