Ejemplo n.º 1
0
    private void gen()
    {
        AlchemyItem[] ingredents = new AlchemyItem[ingredent_count + 1];
        for (int i = 0; i < ingredent_count; i++)
        {
            ingredents[i] = this.ingredents[Random.Range(0, this.ingredents.Length - 1)];
        }
        AlchemyItem output = outputs[Random.Range(0, outputs.Length - 1)];

        ingredents[ingredent_count] = tool;
        var    rname = System.String.Join("_", ingredents.Select(s => s.name.Replace(" ", "_"))) + "To" + output.name;
        string path  = System.IO.Path.Combine("Assets/Scripptable Objects/Recipys", tool.name, rname) + ".asset";
        var    dp    = System.IO.Path.GetDirectoryName(path);

        if (!AssetDatabase.IsValidFolder(dp))
        {
            AssetDatabase.CreateFolder("Assets/Scripptable Objects/Recipys", tool.name);
        }

        var r = ScriptableObject.CreateInstance <Recipe>();

        r.input  = ingredents.ToArray();
        r.output = output;
        AssetDatabase.CreateAsset(r, path);
    }
Ejemplo n.º 2
0
    public void GetItem(AlchemyItem newItem)
    {
        AlchemyItemMB alMB = Instantiate(AlchemyPrefab, Camera.main.ScreenToWorldPoint(Input.mousePosition) + Vector3.forward, Quaternion.identity).GetComponent <AlchemyItemMB>();

        alMB.item.type = newItem;
        alMB.populateGO();
        CurrentSlot.UpdateSlot();
    }
Ejemplo n.º 3
0
 public void UpdateSlot(AlchemyItem AI = null)
 {
     this.AI = AI;
     if (AI != null)
     {
         slotImage.enabled = true;
         slotImage.sprite  = AI.Sprite;
     }
     else
     {
         slotImage.enabled = false;
         slotImage.sprite  = null;
     }
 }