예제 #1
0
 public void Reset(int difficulty)
 {
     currentDifficulty = (DifficultyType)difficulty;
     ResetBoard(currentDifficulty);
     ResetGameStats(currentDifficulty);
     gameUI.Init();
 }
예제 #2
0
 protected virtual void ChangeCallBack()
 {
     GameEntry.Sound.StopSound(s_TopicSoundId);
     GameEntry.Sound.StopSound(s_PanbaiSoundId);
     GameEntry.Sound.StopSound(s_PennySaySoundId);
     GameEntry.Sound.StopSound(TopicTouchBase.s_SoundSerialId);
     GameEntry.Sound.PlayUISound((int)UISoundId.MagicDis);
     //GameEntry.Sound.StopAllLoadedSounds();
     //GameEntry.Sound.StopAllLoadingSounds();
     if (m_DifficultyType == DifficultyType.Easy)
     {
         m_DifficultyType = DifficultyType.Trouble;
     }
     else if (m_DifficultyType == DifficultyType.Trouble)
     {
         m_DifficultyType = DifficultyType.Easy;
     }
     ResetData();
     m_TopicCale.Small();
     InitBackGround(m_DifficultyType);
     //Enter_BrushTopic();
     if (m_Guide != null)
     {
         m_Guide.Close();
     }
 }
예제 #3
0
        public bool ComputeStoryArcChance(int weekCount, DifficultyType difficulty = DifficultyType.common)
        {
            float difficultyAdjustment = 0;

            switch (difficulty)
            {
            case DifficultyType.troublesome:
                difficultyAdjustment = currentTroublesomeChance;
                break;

            case DifficultyType.threatening:
                difficultyAdjustment = currentThreateningChance;
                break;

            case DifficultyType.common:
                difficultyAdjustment = 25f;
                break;
            }

            float checkStoryChance = storyChance + (weekCount * storyChance);

            checkStoryChance += difficultyAdjustment;

            float rollDice = UnityEngine.Random.Range(0.0f, 100.0f);

            //Debug.Log("----------|| Dice Roll for Story: " + rollDice + " over 100" + " Chance Rate:" + checkStoryChance);
            return(rollDice <= checkStoryChance);
        }
예제 #4
0
        public override void Handle(EzClient client, EzPacket packet)
        {
            int            songId      = client.Room.Info.SelectedSong;
            DifficultyType difficulty  = client.Room.Info.Difficulty;
            Score          myBestScore = Database.SelectBestScore(client.Account.Id, songId, difficulty);
            List <Score>   scores      = Database.SelectBestScores(songId, difficulty, 5);

            scores.Sort((x, y) => y.TotalScore.CompareTo(x.TotalScore));

            IBuffer buffer = EzServer.Buffer.Provide();

            if (myBestScore != null)
            {
                buffer.WriteInt32(myBestScore.TotalScore, Endianness.Big);
            }
            else
            {
                buffer.WriteInt32(0, Endianness.Big);
            }

            buffer.WriteByte(0);

            foreach (Score score in scores)
            {
                buffer.WriteFixedString(score.CharacterName, 17, Utils.KoreanEncoding);
                buffer.WriteInt32(score.TotalScore, Endianness.Big);
                buffer.WriteByte(0);
            }

            Send(client, 0x27, buffer);
        }
예제 #5
0
        private static double SpacingWeight(double distance, DifficultyType type)
        {
            if (type == DifficultyType.Speed)
            {
                {
                    double weight;

                    if (distance > SINGLE_SPACING_TRESHOLD)
                    {
                        weight = 2.5;
                    }
                    else if (distance > STREAM_SPACING_TRESHOLD)
                    {
                        weight = 1.6 +
                                 0.9 * (distance - STREAM_SPACING_TRESHOLD) /
                                 (SINGLE_SPACING_TRESHOLD - STREAM_SPACING_TRESHOLD);
                    }
                    else if (distance > ALMOST_DIAMETER)
                    {
                        weight = 1.2 + 0.4 * (distance - ALMOST_DIAMETER) / (STREAM_SPACING_TRESHOLD - ALMOST_DIAMETER);
                    }
                    else if (distance > ALMOST_DIAMETER / 2)
                    {
                        weight = 0.95 + 0.25 * (distance - (ALMOST_DIAMETER / 2)) / (ALMOST_DIAMETER / 2);
                    }
                    else
                    {
                        weight = 0.95;
                    }

                    return(weight);
                }
            }
            return(type == DifficultyType.Aim ? Math.Pow(distance, 0.99) : 0);
        }
예제 #6
0
    public static void HandleGameStartedEvent(GameType gt, DifficultyType dt)
    {
        switch (gt)
        {
        case GameType.OnePlayer:
            gameType = GameType.OnePlayer;
            break;

        case GameType.TwoPlayer:
            gameType = GameType.TwoPlayer;
            break;
        }
        switch (dt)
        {
        case DifficultyType.Easy:
            ballImpulseForce = configurationData.EasyBallImpulseForce;
            minSpawnDelay    = configurationData.EasyMinSpawnDelay;
            maxSpawnDelay    = configurationData.EasyMaxSpawnDelay;
            break;

        case DifficultyType.Medium:
            ballImpulseForce = configurationData.MediumBallImpulseForce;
            minSpawnDelay    = configurationData.MediumMinSpawnDelay;
            maxSpawnDelay    = configurationData.MediumMaxSpawnDelay;
            break;

        case DifficultyType.Hard:
            ballImpulseForce = configurationData.HardBallImpulseForce;
            minSpawnDelay    = configurationData.HardMinSpawnDelay;
            maxSpawnDelay    = configurationData.HardMaxSpawnDelay;
            break;
        }
    }
예제 #7
0
    /// <summary>
    /// "难度"显示 监听
    /// </summary>
    /// <param name="data"></param>
    private void DifficultyShowListener(EventData data)
    {
        //data.param string
        DifficultyType diff = (DifficultyType)Enum.Parse(typeof(DifficultyType), data.Param as string);

        DifficultyShow(diff);
    }
예제 #8
0
        public string GetBoardJson(DifficultyType difficulty = 0)
        {
            string strResult = null;

            try
            {
                string     url    = APIBaseUrl + "?difficulty=" + DiffToStr(difficulty);
                WebRequest reqObj = WebRequest.Create(url);
                reqObj.Method = "GET";

                HttpWebResponse resObj = null;
                resObj = (HttpWebResponse)reqObj.GetResponse();

                using (Stream stream = resObj.GetResponseStream())
                {
                    StreamReader sr = new StreamReader(stream);
                    strResult = sr.ReadToEnd();
                    sr.Close();
                }
            }
            catch
            {
                System.Windows.Forms.MessageBox.Show("API calling failed :^(");
            }

            return(strResult);
        }
예제 #9
0
    public string Generate(DifficultyType difficulty)
    {
        List <string> strings = new List <string>();
        int           nextPick;

        switch (difficulty)
        {
        case DifficultyType.EASY:
        {
            nextPick = Random.Range(0, Commands.Length);
            strings.Add(Commands[nextPick]);
            break;
        }

        case DifficultyType.MEDIUM:
        {
            nextPick = Random.Range(0, Commands.Length);
            strings.Add(Commands[nextPick]);
            nextPick = Random.Range(0, Objects.Length);
            strings.Add(Objects[nextPick]);
            break;
        }

        case DifficultyType.HARD:
            nextPick = Random.Range(0, Commands.Length);
            strings.Add(Commands[nextPick]);
            nextPick = Random.Range(0, Objects.Length);
            strings.Add(Objects[nextPick]);
            nextPick = Random.Range(0, Values.Length);
            strings.Add(Values[nextPick]);
            break;
        }
        return(string.Join(" ", strings.ToArray()));
    }
예제 #10
0
        public int[,] GetBoard(DifficultyType difficulty = 0)
        {
            int[,] result = new int[9, 9];

            string json = GetBoardJson(difficulty);

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

            var jsonObj = new JavaScriptSerializer().Deserialize <Dictionary <string, int[][]> >(json);

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

            for (int x = 0; x < 9; x++)
            {
                for (int y = 0; y < 9; y++)
                {
                    result[x, y] = jsonObj["board"][x][y];
                }
            }

            return(result);
        }
예제 #11
0
 public void SetScore(int lessonId, DifficultyType difficultyType, int score)
 {
     if (m_StudentData != null)
     {
         m_CurSubjectScore = m_StudentData.SetScore(lessonId, difficultyType, score);
         m_TotalScore      = m_StudentData.TotalScore(lessonId);
     }
 }
예제 #12
0
        public IActionResult Start(DifficultyType gameType)
        {
            string fileId = Guid.NewGuid().ToString();
            Game   game   = new Game(fileId);

            game.Difficulty = gameType;
            game.CreateApp();
            return(Ok(game));
        }
예제 #13
0
 public ColorPalette GetDifficultyColor(DifficultyType type)
 {
     if (difficultyColors.TryGetValue(type, out ColorPalette value))
     {
         return(value);
     }
     Logger.LogWarning($"ColorPreset.GetDifficultyColor - Unknown type: {type}");
     return(new ColorPalette(Color.black));
 }
예제 #14
0
 public AdventureAction(AdventureType adventureType, DifficultyType difficultyType, int averagePartyLevel) : base(InteractionType.ADVENTURE)
 {
     AdventureType     = adventureType;
     ChallengeRating   = averagePartyLevel + (int)difficultyType;
     DifficultyType    = difficultyType;
     AveragePartyLevel = averagePartyLevel;
     ParamAdd1         = ((int)adventureType * 1000) + ChallengeRating;
     // not really used, but can be freed later ...
     ParamAdd2 = ((int)difficultyType * 1000) + averagePartyLevel;
 }
예제 #15
0
    public void Change(DifficultyType difficulty)
    {
        if (difficulty == currDifficulty)
        {
            return;
        }

        currDifficulty = difficulty;
        OnDifficultChanged.Invoke(difficulty);
    }
예제 #16
0
    public static int[,] CreateBoard(DifficultyType difficulty)
    {
        BoardData boardData = ConfigManager.Instance.boardConfig.GetBoard(difficulty);

        int[,] board = InitBoardWithMine(
            boardData.width, boardData.height, boardData.mine);
        board = AddClueToBoard(board);

        return(board);
    }
예제 #17
0
        private double CalculateDifficulty(DifficultyType Type)
        {
            // Find the highest strain value within each strain step
            List <double> HighestStrains  = new List <double>();
            double        IntervalEndTime = STRAIN_STEP;
            double        MaximumStrain   = 0; // We need to keep track of the maximum strain in the current interval

            tpHitObject PreviousHitObject = null;

            foreach (tpHitObject hitObject in tpHitObjects)
            {
                // While we are beyond the current interval push the currently available maximum to our strain list
                while (hitObject.BaseHitObject.StartTime > IntervalEndTime)
                {
                    HighestStrains.Add(MaximumStrain);

                    // The maximum strain of the next interval is not zero by default! We need to take the last hitObject we encountered, take its strain and apply the decay
                    // until the beginning of the next interval.
                    if (PreviousHitObject == null)
                    {
                        MaximumStrain = 0;
                    }
                    else
                    {
                        double Decay = Math.Pow(tpHitObject.DECAY_BASE[(int)Type], (double)(IntervalEndTime - PreviousHitObject.BaseHitObject.StartTime) / 1000);
                        MaximumStrain = PreviousHitObject.Strains[(int)Type] * Decay;
                    }

                    // Go to the next time interval
                    IntervalEndTime += STRAIN_STEP;
                }

                // Obtain maximum strain
                if (hitObject.Strains[(int)Type] > MaximumStrain)
                {
                    MaximumStrain = hitObject.Strains[(int)Type];
                }

                PreviousHitObject = hitObject;
            }

            // Build the weighted sum over the highest strains for each interval
            double Difficulty = 0;
            double Weight     = 1;

            HighestStrains.Sort((a, b) => b.CompareTo(a)); // Sort from highest to lowest strain.

            foreach (double Strain in HighestStrains)
            {
                Difficulty += Weight * Strain;
                Weight     *= DECAY_WEIGHT;
            }

            return(Difficulty);
        }
예제 #18
0
 /// <inheritdoc />
 public BlockPlayerCreateGameRequestPayload(string gameName, string password, DifficultyType partyDifficulty, bool isBattleModeEnabled, bool isChallengeModeEnabled, EpisodeType partyEpisode, bool isSinglePlayerModeEnabled)
 {
     this.unk1                      = unk1;
     GameName                       = gameName;
     Password                       = password;
     PartyDifficulty                = partyDifficulty;
     this.isBattleModeEnabled       = isBattleModeEnabled;
     this.isChallengeModeEnabled    = isChallengeModeEnabled;
     PartyEpisode                   = partyEpisode;
     this.isSinglePlayerModeEnabled = isSinglePlayerModeEnabled;
 }
        public void LoadTxtTest()
        {
            DifficultyType type = DifficultyType.Easy;

            String file = String.Format("{0}{1}/{2}/{3}/{4}.txt", CONTENT_ROOT, Constants.CONTENT_DIRECTORY, Constants.DATA_DIRECTORY,
                                        Constants.LEVELS_DIRECTORY, type);

            var data = FileManager.LoadTxt(file);

            Console.WriteLine("Number Lines: " + data.Count);
        }
        public void LoadQuestionListTest()
        {
            // Arrange.
            const DifficultyType type = DifficultyType.Easy;

            // Act.
            QuestionManager.LoadQuestionList(type);

            // Assert.
            Console.WriteLine("Number Questions: " + QuestionManager.QuestionList.Count);
        }
예제 #21
0
 public ShootingRange(Texture2D texture, Rectangle rectangle, DifficultyType difficulty, Textures textures)
     : base(texture, rectangle)
 {
     this.Score      = AccuracyTrainerStateConstants.Score;
     this.Hits       = AccuracyTrainerStateConstants.Hits;
     this.Stage      = AccuracyTrainerStateConstants.Stage;
     this.stageTimer = AccuracyTrainerStateConstants.Score;
     this.difficulty = difficulty;
     this.textures   = textures;
     this.InitializeTargets();
 }
예제 #22
0
        protected double CalculateDifficulty(DifficultyType type)
        {
            double actualStrainStep = STRAIN_STEP * TimeRate;

            // Find the highest strain value within each strain step
            List <double> highestStrains  = new List <double>();
            double        intervalEndTime = actualStrainStep;
            double        maximumStrain   = 0; // We need to keep track of the maximum strain in the current interval

            OsuHitObjectDifficulty previousHitObject = null;

            foreach (OsuHitObjectDifficulty hitObject in DifficultyHitObjects)
            {
                // While we are beyond the current interval push the currently available maximum to our strain list
                while (hitObject.BaseHitObject.StartTime > intervalEndTime)
                {
                    highestStrains.Add(maximumStrain);

                    // The maximum strain of the next interval is not zero by default! We need to take the last hitObject we encountered, take its strain and apply the decay
                    // until the beginning of the next interval.
                    if (previousHitObject == null)
                    {
                        maximumStrain = 0;
                    }
                    else
                    {
                        double decay = Math.Pow(OsuHitObjectDifficulty.DECAY_BASE[(int)type], (intervalEndTime - previousHitObject.BaseHitObject.StartTime) / 1000);
                        maximumStrain = previousHitObject.Strains[(int)type] * decay;
                    }

                    // Go to the next time interval
                    intervalEndTime += actualStrainStep;
                }

                // Obtain maximum strain
                maximumStrain = Math.Max(hitObject.Strains[(int)type], maximumStrain);

                previousHitObject = hitObject;
            }

            // Build the weighted sum over the highest strains for each interval
            double difficulty = 0;
            double weight     = 1;

            highestStrains.Sort((a, b) => b.CompareTo(a)); // Sort from highest to lowest strain.

            foreach (double strain in highestStrains)
            {
                difficulty += weight * strain;
                weight     *= DECAY_WEIGHT;
            }

            return(difficulty);
        }
예제 #23
0
 public CreateGameOut(string name, string pass, string description, DifficultyType difficulty, ushort gameCounter)
 {
     RequestId        = (ushort)(gameCounter * 2);
     Difficulty       = (uint)difficulty;
     Unknown          = 0;
     PlayerDifference = 0xFF;
     MaximumPlayers   = 8;
     GameName         = name;
     GamePassword     = pass;
     GameDescription  = description;
 }
예제 #24
0
    private void ResetGameStats(DifficultyType difficulty)
    {
        BoardData boardData = ConfigManager.Instance.boardConfig.GetBoard(difficulty);

        timeCount     = 0;
        mineCount     = boardData.mine;
        safeCellCount = boardData.width * boardData.height - boardData.mine;
        currentState  = GameState.Running;

        UpdateStatsDisplay();
    }
예제 #25
0
 public int GetScore(DifficultyType _type)
 {
     foreach (Difficulty d in mDifficultyList)
     {
         if (d.mDifficulty == _type)
         {
             return(d.mHighScore);
         }
     }
     throw new System.ArgumentOutOfRangeException("Invalid Type");
 }
예제 #26
0
        public double CalculateDifficulty(DifficultyType Type)
        {
            // Find the highest strain value within each strain step
            List<double> HighestStrains = new List<double>();
            double IntervalEndTime = STRAIN_STEP;
            double MaximumStrain = 0; // We need to keep track of the maximum strain in the current interval

            tpHitObject PreviousHitObject = null;
            foreach (tpHitObject hitObject in tpHitObjects)
            {
                // While we are beyond the current interval push the currently available maximum to our strain list
                while(hitObject.BaseHitObject.StartTime > IntervalEndTime)
                {
                    HighestStrains.Add(MaximumStrain);

                    // The maximum strain of the next interval is not zero by default! We need to take the last hitObject we encountered, take its strain and apply the decay
                    // until the beginning of the next interval.
                    if(PreviousHitObject == null)
                    {
                        MaximumStrain = 0;
                    }
                    else
                    {
                        double Decay = Math.Pow(tpHitObject.DECAY_BASE[(int)Type], (IntervalEndTime - PreviousHitObject.BaseHitObject.StartTime) / 1000);
                        MaximumStrain = PreviousHitObject.Strains[(int)Type] * Decay;
                    }

                    // Go to the next time interval
                    IntervalEndTime += STRAIN_STEP;
                }

                // Obtain maximum strain
                if (hitObject.Strains[(int)Type] > MaximumStrain)
                {
                    MaximumStrain = hitObject.Strains[(int)Type];
                }

                PreviousHitObject = hitObject;
            }

            // Build the weighted sum over the highest strains for each interval
            double Difficulty = 0;
            double Weight = 1;
            HighestStrains.Sort((a,b) => b.CompareTo(a)); // Sort from highest to lowest strain.

            foreach(double Strain in HighestStrains)
            {
                Difficulty += Weight * Strain;
                Weight *= DECAY_WEIGHT;
            }

            return Difficulty;
        }
예제 #27
0
        private double[] ExamPercentage(DifficultyType type)
        {
            switch (type)
            {
            case DifficultyType.Kolay:
                return(new[] { 0.2, 0.3, 0.5 });

            case DifficultyType.Orta:
                return(new[] { 0.2, 0.5, 0.3 });
            }
            return(new[] { 0.5, 0.3, 0.2 });
        }
예제 #28
0
        public async Task <Quiz> GetQuizByDifficultyAsync(DifficultyType difficulty)
        {
            try
            {
                return(await context.Quizzes.FirstOrDefaultAsync(q => q.Difficulty == difficulty));
            }

            catch (Exception ex)
            {
                Debug.WriteLine(ex.InnerException.Message);
                throw null;
            }
        }
예제 #29
0
 protected override void OnOpen(object userData)
 {
     base.OnOpen(userData);
     m_DifficultyType = DifficultyType.Easy;
     m_Controller.SpeekAgainCallBack += SpeekAgainCallBack;
     m_Controller.ResetCallBack      += ResetCallBack;
     m_Controller.ChangeCallBack     += ChangeCallBack;
     m_Controller.NextCallBack       += NextCallBack;
     GameEntry.Windows.SubscribeUIWallEvent(OnLidarHitEvent);
     ResetData();
     InitBackGround(m_DifficultyType);
     InitAnswer();
 }
        public CustomAdventureChoose(MogwaiController mogwaiController, int width, int height) : base("Adventure", "select your adventure", width, height)
        {
            _controller = mogwaiController;
            MogwaiKeys mogwaiKeys = _controller.CurrentMogwaiKeys ?? _controller.TestMogwaiKeys();

            _mogwai = mogwaiKeys.Mogwai;

            _consoleList = new List <MogwaiChooseButton>();

            _currentAdventureType  = AdventureType.Dungeon;
            _currentDifficultyType = DifficultyType.Easy;
            _currentCost           = 0;

            Init();
        }
예제 #31
0
    /// <summary>
    /// 初始化运行时所需的数据
    /// </summary>
    public void InitRuntimeData(bool allInit)
    {
        if (allInit) //可选初始化
        {
            //游戏难度初始化
            difficulty = DifficultyType.Easy;
            //玩家人数初始化
            playerNumber = 1;
        }

        // 玩家id到角色的映射初始化
        ResetPlayerIdToCharacterId(playerNumber);
        //对话计数器初始化
        dialogueRank = 0;
    }
예제 #32
0
 /***********************************************/
 public static int GetCurMineNum(DifficultyType diffType)
 {
     int mineNum = 0;
     switch (diffType) {
     case DifficultyType.Easy:
         mineNum = ConfigData.MINE_NUM_A;
         break;
     case DifficultyType.Normal:
         mineNum = ConfigData.MINE_NUM_B;
         break;
     case DifficultyType.Hard:
         mineNum = ConfigData.MINE_NUM_C;
         break;
     }
     return mineNum;
 }
예제 #33
0
 public void RefreshDiff(DifficultyType type)
 {
     curDiffType = type;
     foreach (UI_DifficultyItem item in settingItems) {
         if(item.diffType == curDiffType)
             item.Yes();
         else
             item.No();
     }
     int curDiffInt = (int)curDiffType;
     if (curDiffInt != PersistentData.instance.CurDiff ()) {
         PersistentData.instance.StoreDiff(curDiffInt);
         Clock.instance.ClockStop();
         Clock.instance.Clear();
         UI_DiffAndMineShower.instance.Refresh();
     }
 }
예제 #34
0
        private bool wasContinuePressed; //bools to holds whether continue was pressed

        #endregion Fields

        #region Constructors

        public Gameplay(SpriteFont font,
            DifficultyType difficultyType,
            Texture2D[] gameplayTextures,
            Texture2D[] playerTextures,
            SoundEffect[] playerSounds,
            Texture2D[] enemyTextures)
        {
            level = new Level(); //initialise level object

            wins = false; //game not won
            exit = false; //exit condition not met

            this.font = font;
            this.difficultyType = difficultyType;
            this.gameplayTextures = gameplayTextures;
            this.playerTextures = playerTextures;
            this.playerSounds = playerSounds;
            this.enemyTextures = enemyTextures;
        }
예제 #35
0
파일: Level.cs 프로젝트: egmcdonald/radio
        /// <summary>
        /// This functions loads the content for the level.
        /// </summary>
        /// <param name="fileStream">stream used to load level from text file</param>
        /// <param name="difficulty">difficulty setting to create level in</param>
        /// <param name="gameplayTextures">gameplay textures (i.e. background/tiles)</param>
        /// <param name="playerTextures">player animation textures</param>
        /// <param name="playerSounds"> player sound effects</param>
        /// <param name="enemyTextures">enemy animation textures</param>
        public void LoadContent(
            Stream fileStream, 
            DifficultyType difficultyType, 
            Texture2D[] gameplayTextures,
            Texture2D[] playerTextures,
            SoundEffect[] playerSounds,
            Texture2D[] enemyTextures)
        {
            switch (difficultyType) //difficulty state switch
            {
                case DifficultyType.Easy:
                    difficulty = new Easy();
                    break;
                case DifficultyType.Medium:
                    difficulty = new Medium();
                    break;
                case DifficultyType.Hard:
                    difficulty = new Hard();
                    break;
            }

            this.winScore = difficulty.winScore;
            this.textureLimit = difficulty.textureLimit;
            this.difficultyType = difficultyType;

            timeCount = TimeSpan.FromMinutes(0.0); //set start time of game to zero

            this.backgroundTexture = gameplayTextures[0]; //load background texture

            //load the tile textures
            this.platformTexture = gameplayTextures[1];
            this.floorATexture = gameplayTextures[2];
            this.floorBTexture = gameplayTextures[3];
            this.floorEdgeLTexture = gameplayTextures[4];
            this.floorEdgeRTexture = gameplayTextures[5];
            LoadTiles(fileStream); //load the tile map

            player = new Player(playerStart);
            player.LoadContent(playerTextures, playerSounds);

            //create new enemy list (i.e. room for multiple enemies)
            enemies = new List<Enemy>();
            enemySpawn = 0;
            enemyIndex = 0;
            this.enemyTextures = enemyTextures;
            walkLeft = false;
            enemyKilled = playerSounds[2];
            LoadEnemy(); //load an initial enemy
        }
예제 #36
0
        // Caution: The subjective values are strong with this one
        private static double SpacingWeight(double distance, DifficultyType Type)
        {

            switch(Type)
            {
                case DifficultyType.Speed:

                    {
                        double Weight;

                        if (distance > SINGLE_SPACING_TRESHOLD)
                        {
                            Weight = 2.5;
                        }
                        else if (distance > STREAM_SPACING_TRESHOLD)
                        {
                            Weight = 1.6 + 0.9 * (distance - STREAM_SPACING_TRESHOLD) / (SINGLE_SPACING_TRESHOLD - STREAM_SPACING_TRESHOLD);
                        }
                        else if (distance > ALMOST_DIAMETER)
                        {
                            Weight = 1.2 + 0.4 * (distance - ALMOST_DIAMETER) / (STREAM_SPACING_TRESHOLD - ALMOST_DIAMETER);
                        }
                        else if (distance > ALMOST_DIAMETER / 2)
                        {
                            Weight = 0.95 + 0.25 * (distance - (ALMOST_DIAMETER / 2)) / (ALMOST_DIAMETER / 2);
                        }
                        else
                        {
                            Weight = 0.95;
                        }

                        return Weight;
                    }


                case DifficultyType.Aim:

                    return Math.Pow(distance, 0.99);


                    // Should never happen. 
                default:
                    return 0;
            }
        }
예제 #37
0
        /// <summary>
        /// Starts driver
        /// </summary>
        /// <param name="game">Game name to join/create</param>
        /// <param name="pass">Game pass to join/create</param>
        /// <param name="difficulty">Game difficulty</param>
        public void Start(string game, string pass, DifficultyType difficulty)
        {
            if (!IsInitalized)
            {
                throw new Exception("Driver not initalized!");
            }

            // convert game password to Titlecase
            TextInfo myTI = new CultureInfo("en-US", false).TextInfo;

            settings.GameName = game;
            settings.GamePass = myTI.ToTitleCase(pass);
            settings.GameDifficulty = difficulty;
            settings.GameDescription = difficulty.ToString();

            PushBot();
        }
예제 #38
0
        private void CalculateSpecificStrain(tpHitObject PreviousHitObject, DifficultyType Type)
        {
            double Addition = 0;
            double TimeElapsed = BaseHitObject.StartTime - PreviousHitObject.BaseHitObject.StartTime;
            double Decay = Math.Pow(DECAY_BASE[(int)Type], TimeElapsed / 1000);

            if (BaseHitObject.GetType() == typeof(SpinnerObject))
            {
                // Do nothing for spinners
            }
            else if (BaseHitObject.GetType() == typeof(SliderObject))
            {
                switch(Type)
                {
                    case DifficultyType.Speed:

                        // For speed strain we treat the whole slider as a single spacing entity, since "Speed" is about how hard it is to click buttons fast.
                        // The spacing weight exists to differentiate between being able to easily alternate or having to single.
                        Addition =
                            SpacingWeight(PreviousHitObject.LazySliderLengthFirst +
                                          PreviousHitObject.LazySliderLengthSubsequent * (((SliderObject)BaseHitObject).RepeatCount - 1) +
                                          DistanceTo(PreviousHitObject), Type) *
                            SPACING_WEIGHT_SCALING[(int)Type];
                        break;


                    case DifficultyType.Aim:

                        // For Aim strain we treat each slider segment and the jump after the end of the slider as separate jumps, since movement-wise there is no difference
                        // to multiple jumps.
                        Addition =
                            (
                                SpacingWeight(PreviousHitObject.LazySliderLengthFirst, Type) +
                                SpacingWeight(PreviousHitObject.LazySliderLengthSubsequent, Type) * (((SliderObject)BaseHitObject).RepeatCount - 1) +
                                SpacingWeight(DistanceTo(PreviousHitObject), Type)
                            ) *
                            SPACING_WEIGHT_SCALING[(int)Type];
                        break;
                }
                
            }
            else if (BaseHitObject.GetType() == typeof(CircleObject))
            {
                Addition = SpacingWeight(DistanceTo(PreviousHitObject), Type) * SPACING_WEIGHT_SCALING[(int)Type];
            }

            // Scale addition by the time, that elapsed. Filter out HitObjects that are too close to be played anyway to avoid crazy values by division through close to zero.
            // You will never find maps that require this amongst ranked maps.
            Addition /= Math.Max(TimeElapsed, 50);

            Strains[(int)Type] = PreviousHitObject.Strains[(int)Type] * Decay + Addition;
        }
예제 #39
0
 public Difficulty(string[] d,DifficultyType p)
 {
     descriptions = d; problemType = p.ToString();
 }
예제 #40
0
 void Awake()
 {
     instance = this;
     curDiffType = (DifficultyType)(PersistentData.instance.CurDiff());
     RefreshDiff (curDiffType);
 }
예제 #41
0
 public CreateGameOut(string name, string pass, string description, DifficultyType difficulty, ushort gameCounter)
 {
     RequestId = (ushort)(gameCounter * 2);
     Difficulty = (uint)difficulty;
     Unknown = 0;
     PlayerDifference = 0xFF;
     MaximumPlayers = 8;
     GameName = name;
     GamePassword = pass;
     GameDescription = description;
 }