コード例 #1
0
        /// <summary>
        /// returns the number of starts the player has earned for the level
        /// </summary>
        /// <returns>number of half-stars,from 0-6</returns>
        public int GetLevelScore()
        {
            LevelDifficultyInfo info = levelsInfo[currentNeigh, currentLevel];
            float score = 0, stealthScore = 0,
                  timeScore = timer.FinishTimer() / info.bestTime, ///precentage of the best time achived by the user
                  giftScore = giftsCollected / info.numOfGifts;

            if (giftScore == 0)
            {
                return(0);                   ///no participation prizes in this game
            }
            foreach (AwarenessState state in enemiesAlerted.Keys)
            {
                stealthScore += enemiesAlerted[state] * awarnessWeight[state];
            }
            stealthScore /= info.numOfEnemies;

            score = timeScore + giftScore + stealthScore;
            if (score > 6.0f)
            {
                score = 6.0f;
            }
            scoreLog[currentNeigh, currentLevel] = Mathf.RoundToInt(score);
            return(Mathf.RoundToInt(score));
        }
コード例 #2
0
        void CreateLevelsInfoArray(string m_Path)
        {
            LevelDifficultyInfo[,] data = new LevelDifficultyInfo[, ]
            {
                { new LevelDifficultyInfo(12, 3, 4, 6f), new LevelDifficultyInfo(1, 2, 3, 3f) },
                { new LevelDifficultyInfo(5, 2, 9, 1f), new LevelDifficultyInfo(4, 3, 8, 8f) }
            };

            DataHandler.WriteToBinaryFile <LevelDifficultyInfo[, ]>(m_Path, data);
        }