37 lines
740 B
C#
37 lines
740 B
C#
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using System.IO;
|
||
|
using UnityEngine;
|
||
|
|
||
|
namespace BITKit.Entities.Player
|
||
|
{
|
||
|
public class ProxyPlayerComponent : EntityBehavior,IEntityBinaryComponent
|
||
|
{
|
||
|
public int Id { get; } = new ConstantHash(nameof(LocalPlayerBehavior));
|
||
|
private readonly IntervalUpdate _timeout = new(8);
|
||
|
public override void OnStart()
|
||
|
{
|
||
|
base.OnStart();
|
||
|
_timeout.Reset();
|
||
|
}
|
||
|
public void Serialize(BinaryWriter writer)
|
||
|
{
|
||
|
}
|
||
|
public void Deserialize(BinaryReader reader)
|
||
|
{
|
||
|
reader.ReadInt32();
|
||
|
_timeout.Reset();
|
||
|
}
|
||
|
public override void OnUpdate(float deltaTime)
|
||
|
{
|
||
|
base.OnUpdate(deltaTime);
|
||
|
if (_timeout.AllowUpdate)
|
||
|
{
|
||
|
Destroy(gameObject);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|