Exemplo n.º 1
0
        public static EntityDataEnemy Create(EnemyData enemyData, LevelPath levelPath, object userData = null)
        {
            EntityDataEnemy entityData = ReferencePool.Acquire <EntityDataEnemy>();

            entityData.EnemyData = enemyData;
            entityData.LevelPath = levelPath;
            return(entityData);
        }
Exemplo n.º 2
0
        public static EntityDataEnemy Create(EnemyData enemyData, LevelPath levelPath, Vector3 position, Quaternion rotation, object userData = null)
        {
            EntityDataEnemy entityData = ReferencePool.Acquire <EntityDataEnemy>();

            entityData.EnemyData = enemyData;
            entityData.LevelPath = levelPath;
            entityData.Position  = position;
            entityData.Rotation  = rotation;
            return(entityData);
        }
        public void SpawnEnemy(int enemyId)
        {
            EnemyData enemyData = dataEnemy.GetEnemyData(enemyId);

            if (enemyData == null)
            {
                Log.Error("Can not get enemy data by id '{0}'.", enemyId);
                return;
            }

            entityLoader.ShowEntity(enemyData.EntityId, TypeUtility.GetEntityType(enemyData.Type),
                                    (entity) =>
            {
                dicEntityEnemy.Add(entity.Id, (EntityEnemy)entity.Logic);
            },
                                    EntityDataEnemy.Create(
                                        enemyData,
                                        levelManager.GetLevelPath(),
                                        levelManager.GetStartPathNode().position - new Vector3(0, 0.2f, 0),
                                        Quaternion.identity));
        }