예제 #1
0
        /// <summary>
        /// Обновляет данные игрока
        /// </summary>
        private static IEnumerable <RapperModel> GetRatingList(PlayerInfo playerInfo)
        {
            var rappers    = RappersManager.GetRappers();
            var ratingList = new RapperModel[rappers.Count + 1];

            rappers.CopyTo(ratingList);
            ratingList[rappers.Count] = new RapperModel {
                Name = playerInfo.Name, Fans = playerInfo.Fans
            };
            return(ratingList);
        }
예제 #2
0
        /// <summary>
        /// Вычисляет согласие рэппера на фит или батл
        /// </summary>
        public static bool IsAgree(RapperModel rapper, int playerFans)
        {
            var percentage = (float)playerFans / rapper.Fans * 100;

            if (percentage < 1)
            {
                return(false);
            }
            if (percentage > 100)
            {
                return(true);
            }
            return(percentage >= Random.Range(1, 101));
        }
예제 #3
0
        /// <summary>
        /// Возвращает очки за флоу
        /// </summary>
        private static int GetFlowPoints(RapperModel rival)
        {
            var flowDifference = PlayerManager.GetSkills().Flow - rival.Flow;

            return(20 + flowDifference);
        }
예제 #4
0
 /// <summary>
 /// Заполняет строку в рейтинге
 /// </summary>
 public void Setup(RapperModel model, int position, bool isPlayer)
 {
     PlayerIcon.gameObject.SetActive(isPlayer);
     Name.text = $"{position}. {model.Name}";
     Fans.text = $"{NumberFormatter.FormatValue(model.Fans)}";
 }