예제 #1
0
        private void InitializeRandomStats(int currentLevel, ref Unity.Mathematics.Random random,
                                           ref HealthStatComponent healthStatComponent,
                                           ref AttackStatComponent attackStatComponent,
                                           ref DefenceStatComponent defenceStatComponent,
                                           ref MagicStatComponent magicStatComponent)
        {
            var points = random.NextInt(currentLevel, currentLevel * 2);

            for (var i = 1; i < points; i++)
            {
                var randomStat = random.NextInt(0, 100);
                if (randomStat < 25)
                {
                    healthStatComponent.PointsSpent++;
                }
                else if (randomStat < 50)
                {
                    attackStatComponent.PointsSpent++;
                }
                else if (randomStat < 75)
                {
                    defenceStatComponent.PointsSpent++;
                }
                else if (randomStat < 100)
                {
                    magicStatComponent.PointsSpent++;
                }
            }
        }
예제 #2
0
        private void SetUpStatsText(StatsGroupWrapper statsGroup, HealthStatComponent healthstatComponent, AttackStatComponent attackStatComponent, DefenceStatComponent defenceStatComponent, MagicStatComponent magicStatComponent, int addPointButtonAlpha)
        {
            statsGroup.HealthStat.PointsSpent.text = healthstatComponent.CurrentValue.ToString();
            statsGroup.HealthStat.AddButton.GetComponent <CanvasGroup>().alpha = addPointButtonAlpha;

            statsGroup.AttackStat.PointsSpent.text = attackStatComponent.CurrentValue.ToString();
            statsGroup.AttackStat.AddButton.GetComponent <CanvasGroup>().alpha = addPointButtonAlpha;

            statsGroup.DefenceStat.PointsSpent.text = defenceStatComponent.CurrentValue.ToString();
            statsGroup.DefenceStat.AddButton.GetComponent <CanvasGroup>().alpha = addPointButtonAlpha;

            statsGroup.MagicStat.PointsSpent.text = magicStatComponent.CurrentValue.ToString();
            statsGroup.MagicStat.AddButton.GetComponent <CanvasGroup>().alpha = addPointButtonAlpha;
        }