コード例 #1
0
        public Color GetColor(GameEnums.Quality quality)
        {
            var c = Color.white;

            switch (quality)
            {
            case GameEnums.Quality.BROKEN:
                c = new Color(0.4f, 0.2f, 0.2f);
                break;

            case GameEnums.Quality.DAMAGED:
                c = new Color(0.4f, 0.4f, 0.4f);
                break;

            case GameEnums.Quality.NORMAL:
                c = new Color(1.0f, 1.0f, 1.0f);
                break;

            case GameEnums.Quality.GOOD:
                c = NGUIMath.HexToColor(0x00baffff);
                break;

            case GameEnums.Quality.EPIC:
                c = NGUIMath.HexToColor(0x9600ffff);
                break;
            }

            return(c);
        }
コード例 #2
0
        private float GenerateMultiplier(int level, GameEnums.Quality quality)
        {
            var mult = 0f;

            switch (quality)
            {
            case GameEnums.Quality.BROKEN:
                mult = 0f;
                break;

            case GameEnums.Quality.DAMAGED:
                mult = 0.25f;
                break;

            case GameEnums.Quality.NORMAL:
                mult = 1f;
                break;

            case GameEnums.Quality.GOOD:
                mult = 1.75f;
                break;

            case GameEnums.Quality.EPIC:
                mult = 2.5f;
                break;
            }

            //Take level into account with a capped level of 100
            var linear = level / 100f;

            //Add a curve for more interesting results
            mult *= Mathf.Lerp(linear, linear * linear, 0.5f);

            return(mult);
        }
コード例 #3
0
        private ItemData CreateItemData(int aLevel, GameEnums.Quality aQuality, int aMintogenerate, int aMaxtogenerate)
        {
            //the list to store the stats, up to 5 stats for this item
            var stats = GenerateRandomStats(aLevel, 5, aQuality);

            ItemData itData = new ItemData(aMintogenerate, Random.Range(aMintogenerate, aMaxtogenerate), stats);

            return(itData);
        }
コード例 #4
0
        private int GeneratePrice(int level, int priceBase, GameEnums.Quality quality)
        {
            var price = 0;

            var multiplier = GenerateMultiplier(level, quality);

            price = Mathf.CeilToInt(Random.Range(priceBase * multiplier, ((priceBase * multiplier) + (priceBase * 2))));

            return(price);
        }
コード例 #5
0
 public Item(int aPrice, int aLevel, uint id, GameEnums.Quality aQuality, ItemData anItem)
 {
     equipped     = false;
     price        = aPrice;
     data         = anItem;
     quality      = aQuality;
     level        = aLevel;
     initialValue = anItem.maxAmount;
     objectId     = id;
 }
コード例 #6
0
        private List <ItemStats> GenerateRandomStats(int level, int maxAmount, GameEnums.Quality quality)
        {
            //the list to store the stats
            var stats = new List <ItemStats>();

            //this item will have between 1 and maxamount stats attached
            var randStatsAmount = Random.Range(1, maxAmount);

            var prevAttribute = GameEnums.AttributesType.MAX;
            var attributeType = GameEnums.AttributesType.MAX;

            //generate the stats we need
            for (var i = 0; i < randStatsAmount; i++)
            {
                attributeType = (GameEnums.AttributesType)Random.Range(0, (int)GameEnums.AttributesType.MAX);

                //make sure we do not duplicate attributes
                while (attributeType == prevAttribute)
                {
                    attributeType = (GameEnums.AttributesType)Random.Range(0, (int)GameEnums.AttributesType.MAX);
                }

                prevAttribute = attributeType;

                var modifier = (GameEnums.Modifier)Random.Range(0, (int)GameEnums.Modifier.MAX);

                var value = modifier == GameEnums.Modifier.PERCENTAGE
                    ? GenerateMultiplier(level, quality)
                    : Random.Range(1, level);

                var attr = new AttributeType(value, attributeType);

                var itStats = new ItemStats(attr, modifier);

                stats.Add(itStats);
            }

            return(stats);
        }
コード例 #7
0
ファイル: Arrow.cs プロジェクト: EskemaGames/Inventario_Unity
 public Arrow(int aPrice, int aLevel, uint id, GameEnums.Quality aQuality, ItemData anItem)
     : base(aPrice, aLevel, id, aQuality, anItem)
 {
 }