示例#1
0
 /// <summary>
 /// Constructor of this data structure.
 /// </summary>
 /// <param name="levelSceneName">The scene name of this level.</param>
 /// <param name="levelDisplayName">The level's display name.</param>
 /// <param name="difficulty">The difficulty of the level. (Range 0 - 10)</param>
 /// <param name="levelType">The level type.</param>
 public GameLevelInfo(string levelSceneName, string levelDisplayName, int difficulty, GameLevelType levelType)
 {
     this.LevelSceneName   = levelSceneName;
     this.LevelDisplayName = levelDisplayName;
     this.Difficulty       = difficulty;
     this.LevelType        = levelType;
 }
示例#2
0
        public IList <GameLevelImage> GetImagesByModule(GameLevelType type)
        {
            var gameLevelImages = _mongoRepository.FilterBy(
                filter => (filter.Deleted == false &&
                           filter.GameLevelType == type
                           ));

            return(gameLevelImages.ToList());
        }
        public double GetProgressByModule(string userId, GameLevelType module)
        {
            UserProgressDTO userProgress = new UserProgressDTO()
            {
                UserId = userId,
                Module = module
            };

            return(_userService.GetProgressByModule(userProgress));
        }
示例#4
0
 private void DrawInfo(int lives, int score, GameLevelType gameLevel, int gamesCounter, int highestScore, TimeSpan timer)
 {
     ScreenBuffer.Draw(this.Position.X + 11, 9, string.Format("{0}", this.Engine.Player.Name), Theme.Green, true);
     ScreenBuffer.Draw(this.Position.X + 16, 11, string.Format("{0,3}", lives), ConsoleColor.Red, true);
     ScreenBuffer.Draw(this.Position.X + 12, 12, string.Format("{0,7}", score), ConsoleColor.Red, true);
     ScreenBuffer.Draw(this.Position.X + 12, 13, string.Format("{0,7}", gameLevel), ConsoleColor.DarkGreen, true);
     ScreenBuffer.Draw(this.Position.X + 16, 30, string.Format("{0,5}", gamesCounter), ConsoleColor.DarkGreen, true);
     ScreenBuffer.Draw(this.Position.X + 16, 31, string.Format("{0,2}:{1:00}", timer.Minutes, timer.Seconds), ConsoleColor.DarkGreen, true);
     ScreenBuffer.Draw(this.Position.X + 2, 34, string.Format("{0}", this.Engine.Player.Name), ConsoleColor.DarkGreen, true);
     ScreenBuffer.Draw(this.Position.X + 15, 34, string.Format("{0,6}", highestScore), ConsoleColor.DarkGreen, true);
 }
示例#5
0
    //Main map gen method
    public string GenerateGameField(GameLevelType type, string seed = " ")
    {
        Vector2 playerSpawn = Vector2.zero;

        myMapStyle             = Resources.Load <GameMapStyle>(Path.Combine("MapStyles", mapStyles.GetCurrentMapStyle(Relocation.CurrentDungeonLevel)));
        postProccesing.profile = myMapStyle.levelPostProccess;
        CreateMapHolders();
        bool useRandomSeed = seed.Equals(" ") ? true : false;

        if (type == GameLevelType.SimpleLevel)
        {
            //Map base gen
            GenerateMap(useRandomSeed, seed);
            //Noise generation
            int     noiseSeed   = Random.Range(0, 999999);
            Vector2 noiseOffset = new Vector2(Random.Range(-9999, 9999), Random.Range(-9999, 9999));
            float[,] noise = Noise.GenerateNoiseMap(mapSize.xMapSize, mapSize.yMapSize, noiseSeed, scale, octaves, persistance, lacunarity, noiseOffset);
            var groundRegions = Noise.GetClearNoiseRegions(noise, myMapStyle.GetGroundSize(), mapMask);
            for (int i = 0; i < groundRegions.Length; i++)
            {
                var region = groundRegions[i];
                for (int k = 0; k < region.tiles.Count; k++)
                {
                    Vector2Int pos = region.tiles[k];
                    int        sum = 0;
                    if (region.tiles.Contains(new Vector2Int(pos.x, pos.y + 1)))
                    {
                        sum += 1;
                    }
                    if (region.tiles.Contains(new Vector2Int(pos.x + 1, pos.y)))
                    {
                        sum += 2;
                    }
                    if (region.tiles.Contains(new Vector2Int(pos.x, pos.y - 1)))
                    {
                        sum += 4;
                    }
                    if (region.tiles.Contains(new Vector2Int(pos.x - 1, pos.y)))
                    {
                        sum += 8;
                    }
                    SpawnGround(pos.x, pos.y, region.groundLayerIndex, sum);
                }
            }
            for (int x = 0; x < mapSize.xMapSize; x++)
            {
                for (int y = 0; y < mapSize.yMapSize; y++)
                {
                    if (mapMask[x, y] == 1)                    //if walls
                    {
                        bool canSpawnWall = false;
                        for (int k = x - 1; k <= x + 1; k++)
                        {
                            for (int j = y - 1; j <= y + 1; j++)
                            {
                                try{
                                    if (mapMask[k, j] == 0)
                                    {
                                        canSpawnWall = true;
                                        break;
                                    }
                                }catch (Exception ex) {
                                    continue;
                                }
                            }
                            if (canSpawnWall)
                            {
                                break;
                            }
                        }
                        if (canSpawnWall)
                        {
                            SpawnWall(x, y);
                        }
                    }
                }
            }
            playerSpawn = GeneratePlayerPos();
            SpawnLevelMobs(playerSpawn);
            SpawnBuildings(playerSpawn);
            SpawnProps(playerSpawn);
            SpawnBlocks();
            SpawnPlayerDeathPoint();
        }
        else if (type == GameLevelType.CheckPoint)
        {
            SpawnCheckPointRoom();
            playerSpawn = Vector2.zero;
        }
        else if (type == GameLevelType.BossLevel)
        {
            SpawnBossLevel();
        }
        GameSession.SpawnPlayer(new Vector3(playerSpawn.x, playerSpawn.y, 0f));
        return(this.seed);
    }
示例#6
0
 /// <summary>
 ///选择场次的方法
 /// </summary>
 void OnClickMethod(GameLevelType type)
 {
     request.gameLevelType = type;
     EZComponent.AddConment <Game_SelectItem>();//进入选择道具页面
 }