该项目的目的是同时测试和演示来自 Unity DOTS 技术堆栈的多个新包。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

37 行
1.2 KiB

using System.Collections;
using System.Collections.Generic;
using Unity.Animation;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Transforms;
using UnityEngine;
using Unity.NetCode;
using Unity.Sample.Core;
#if UNITY_EDITOR
public class ItemAuthoring : MonoBehaviour, IConvertGameObjectToEntity
{
public AbilityCollectionAuthoring.AbilitySetup[] abilities = new AbilityCollectionAuthoring.AbilitySetup[0];
// public BoneReferenceAuthoring attachBone; // TODO (mogensh) Use BoneReferenceAuthoring when all conversion happens in editor
public BoneReference attachBone2;
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
{
GameDebug.Log(string.Format("Convert Item:{0}",this));
dstManager.AddComponentData(entity,Item.InputState.Default);
AbilityCollectionAuthoring.AddAbilityComponents(entity, dstManager, conversionSystem, abilities);
var runtimeBoneRef = RuntimeBoneReference.Default;
runtimeBoneRef.ReferenceRig = RigDefinitionAsset.ConvertRig(attachBone2.RigAsset);
runtimeBoneRef.BoneIndex = attachBone2.BoneIndex;
RigAttacher.AddRigAttacher(entity, dstManager, runtimeBoneRef);
}
}
#endif