46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class MarisaPotionMaker : MicroGameHandler
|
|
{
|
|
public Potion currentPotion;
|
|
public List<Potion> requestedPotions = new();
|
|
public List<Potion> completedPotions = new();
|
|
public List<Potion> failedPotions = new(); //bad to have 3 lists but whatever.
|
|
public int currentPotionIndex;
|
|
|
|
public class Potion
|
|
{
|
|
public string[] chemicals;
|
|
}
|
|
|
|
public void AddChemical(string chemical)
|
|
{
|
|
if (currentPotion.chemicals[currentPotionIndex+1] == chemical )
|
|
{
|
|
currentPotionIndex++;
|
|
if (currentPotion.chemicals.Length > currentPotionIndex)
|
|
{
|
|
CompletePotion(currentPotion, true);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
CompletePotion(currentPotion, false);
|
|
}
|
|
}
|
|
|
|
public void CompletePotion(Potion potion, bool success)
|
|
{
|
|
requestedPotions.Remove(potion); //doesn't work if there's multiple of the same potion....
|
|
if (success)
|
|
{
|
|
completedPotions.Add(potion);
|
|
}
|
|
else
|
|
{
|
|
failedPotions.Add(potion);
|
|
}
|
|
}
|
|
}
|