コード例 #1
0
        public static void ShowActorEntity(this EntityComponent entityComponent, Type logicType, EntityData data)
        {
            if (data == null)
            {
                Log.Warning("Data is invalid.");
                return;
            }

            if (entityComponent.HasEntity(data.Id))
            {
                Log.Warning(string.Format("Entity {0} is exist.", data.Id));
                return;
            }

            IDataTable <DRActorEntity> dtActorEntity = GameEntry.DataTable.GetDataTable <DRActorEntity>();
            DRActorEntity drActorEntity = dtActorEntity.GetDataRow(data.TypeId);

            if (drActorEntity == null)
            {
                Log.Warning("Can not load entity id '{0}' from data table.", data.TypeId.ToString());
                return;
            }
            entityComponent.ShowEntity(data.Id, logicType, AssetUtility.GetEntityAsset(drActorEntity.ModelAsset),
                                       drActorEntity.Group, data);
        }
コード例 #2
0
        private void OnKillMonster(object sender, GameEventArgs e)
        {
            KillMonsterEventArgs ne            = e as KillMonsterEventArgs;
            DRActorEntity        drActorEntity = GameEntry.DataTable.GetDataTable <DRActorEntity>().GetDataRow(ne.MonsterId);

            if (drActorEntity.KillExp <= 0)
            {
                return;
            }

            int maxLevle = GameEntry.DataTable.GetDataTable <DRHeroLevel>().Count;

            if (drActorEntity.KillExp > 0)
            {
                TryAddExp(drActorEntity.KillExp);
            }
        }
コード例 #3
0
ファイル: ActorBase.cs プロジェクト: mengtest/demo_tankWar3D
        public ActorBase(RoleEntityBase entity, ActorType type, BattleCampType camp,
                         CharacterController cc, Animator anim)
        {
            if (entity == null || cc == null || anim == null)
            {
                throw new GameFrameworkException("Construct Actor Fail.");
            }

            Entity          = entity;
            Id              = entity.TypeId;
            EntityId        = entity.Id;
            EntityGo        = entity.gameObject;
            CachedTransform = EntityGo.transform;

            m_CharacterController         = cc;
            m_CharacterController.enabled = true;
            m_Animator = anim;
            ActorType  = type;
            Camp       = camp;

            m_ActorData = GameEntry.DataTable.GetDataTable <DRActorEntity>().GetDataRow(Id);
        }