1
This commit is contained in:
36
Src/Unity/Scripts/Entity/Player/ProxyPlayerComponent.cs
Normal file
36
Src/Unity/Scripts/Entity/Player/ProxyPlayerComponent.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user