Exemple #1
0
        /// <summary>
        /// 初始化回调
        /// </summary>
        /// <param name="userData">用户自定义数据</param>
        protected override void OnInit(UnityGameFrame.Runtime.Entity entity, object userData)
        {
            base.OnInit(entity, userData);

            UserEntityData = userData as UserEntityData;
            UserEntityData.RuntimeEntity = this;
            InitLogicData(UserEntityData);

            //Log.Info(Utility.Text.Format("实体逻辑Init -> {0}", HotLogicScript));
        }
        /// <summary>
        /// 根据实体id获取实体
        /// </summary>
        /// <param name="entityComponent">实体组件</param>
        /// <param name="entityId">实体编号</param>
        /// <returns>逻辑实体</returns>
        public static EntityLogicBase GetGameEntity(this EntityComponent entityComponent, int entityId)
        {
            UnityGameFrame.Runtime.Entity entity = entityComponent.GetEntity(entityId);
            HotEntity hotEntity = entity.Logic as HotEntity;

            if (hotEntity == null)
            {
                return(null);
            }

            return(hotEntity.HotLogicInstance as EntityLogicBase);
        }
Exemple #3
0
        private void OnTriggerExit(Collider other)
        {
            GameObject go     = other.gameObject;
            Entity     entity = go.GetComponent <Entity>();

            if (entity == null)
            {
                Log.Warning("Unknown GameObject '{0}', you must use entity only.", go.name);
                Destroy(go);
                return;
            }

            GameEntry.Entity.HideEntity(entity);
        }
 protected override void OnInit(UnityGameFrame.Runtime.Entity entity, object userData)
 {
     base.OnInit(entity, userData);
     CachedAnimation = GetComponent <Animation>();
 }