更改文件架构
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using BITKit;
|
||||
namespace BITKit.Entities
|
||||
{
|
||||
public class EntityLocalPlayer : EntityComponent
|
||||
{
|
||||
public override void OnStart()
|
||||
{
|
||||
base.OnStart();
|
||||
entity.Set<bool>(nameof(EntityComponent.isLocalPlayer), true);
|
||||
if (isSpawned is false)
|
||||
{
|
||||
foreach (var x in GetComponentsInChildren<IEntityComponent>(true))
|
||||
{
|
||||
x.OnSpawn();
|
||||
}
|
||||
entity.Set<bool>(nameof(isSpawned), true);
|
||||
}
|
||||
IEntity.LocalPlayer = entity;
|
||||
IEntity.OnSpawnLocalPlayer.Invoke(entity);
|
||||
}
|
||||
public override void OnDestroyComponent()
|
||||
{
|
||||
base.OnDestroyComponent();
|
||||
if (isSpawned)
|
||||
{
|
||||
foreach (var x in GetComponentsInChildren<IEntityComponent>(true))
|
||||
{
|
||||
x.OnDespawn();
|
||||
}
|
||||
entity.Set<bool>(nameof(isSpawned), false);
|
||||
}
|
||||
IEntity.LocalPlayer = null;
|
||||
}
|
||||
public override void OnSpawn()
|
||||
{
|
||||
BIT4Log.Log<EntityLocalPlayer>("已创建本地玩家");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d2434312d3046294b8c91f033e26d294
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user