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
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, armor
|
|
/// </summary>
|
|
[CreateAssetMenu]//Allows creating ViewConfig objects in Assets -> Create menu in the Unity Editor
|
|
public class ProceduralArmorFactory : ItemFactory
|
|
{
|
|
public ItemRarity Rarity;
|
|
public int DefenseMin;
|
|
public int DefenseMax;
|
|
public int PriceMin;
|
|
public int PriceMax;
|
|
public ItemPrototype[] Items;
|
|
public int Amount;
|
|
|
|
public override void PopulateInventory(Inventory model)
|
|
{
|
|
for (int i = 0; i < Amount; i++)
|
|
{
|
|
var item = Items[Random.Range(0, Items.Length)];
|
|
model.AddItem(new ItemArmor(item.Name,item.Sprite.name,Random.Range(PriceMin,PriceMax),Random.Range(DefenseMax,DefenseMax) + item.Bonus,Random.Range(DefenseMin,DefenseMax) + item.Bonus + 3,item.Description, Rarity));
|
|
}
|
|
}
|
|
}
|