转载请注明,原文地址:http://www.benmutou.com/archives/2587 文章来源:笨木头与游戏开发
using GameFramework;
using UnityGameFramework.Runtime;
/// <summary>
/// 英雄逻辑处理
/// </summary>
public class Demo6_HeroLogic : EntityLogic
{
    protected Demo6_HeroLogic()
    {
    }
    protected override void OnShow (object userData) {
        base.OnShow (userData);
        Log.Debug("显示英雄实体.");
    }
}
 using GameFramework;
using GameFramework.Procedure;
using UnityGameFramework.Runtime;
using ProcedureOwner = GameFramework.Fsm.IFsm<GameFramework.Procedure.IProcedureManager>;
public class Demo6_ProcedureLaunch : ProcedureBase {
	protected override void OnEnter(ProcedureOwner procedureOwner)
	{
		base.OnEnter(procedureOwner);
		// 获取框架实体组件
		EntityComponent entityComponent
			= UnityGameFramework.Runtime.GameEntry.GetComponent<EntityComponent>();
		// 创建实体
		entityComponent.ShowEntity<Demo6_HeroLogic>(1, "Assets/Demo6/CubeEntity.prefab", "EntityGroup");
	}
}
加载实体自然需要用到框架的实体组件,调用实体组件的ShowEntity即可加载实体。


