MVC shop project for software architecture, in Unity.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

29 lines
1.0 KiB

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Random = UnityEngine.Random;
/// <summary>
/// This item factory uses all specified properties to procedurally generate a given amount of items. In this case, weapons
/// </summary>
[CreateAssetMenu]//Allows creating ViewConfig objects in Assets -> Create menu in the Unity Editor
public class ProceduralWeaponFactory : ItemFactory
{
public ItemRarity Rarity;
public int DamageMin;
public int DamageMax;
public int PriceMin;
public int PriceMax;
public ItemPrototype[] Items;
public int Amount;
public override void PopulateModel(ShopModel model)
{
for (int i = 0; i < Amount; i++)
{
var item = Items[Random.Range(0, Items.Length)];
model.inventory.AddItem(new ItemWeapon(item.Name,item.Sprite.name,Random.Range(PriceMin,PriceMax),Random.Range(DamageMin,DamageMax) + item.Bonus,Random.Range(DamageMin,DamageMax) + item.Bonus + 3,item.Description, Rarity));
}
}
}