yeah i dunno what you want me to write.
This commit is contained in:
parent
79fcc7ce34
commit
9304861963
3 changed files with 355 additions and 2 deletions
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
public class MarisaPotionMaker : MicroGameHandler
|
||||
{
|
||||
|
|
@ -21,6 +22,17 @@ public class MarisaPotionMaker : MicroGameHandler
|
|||
|
||||
#endregion
|
||||
|
||||
public Chemical[] allChemicals;
|
||||
|
||||
[Serializable]
|
||||
public class ChemicalSpawnPoint //this sucks but whatever!
|
||||
{
|
||||
public Transform location;
|
||||
public bool inUse;
|
||||
}
|
||||
public ChemicalSpawnPoint[] chemicalSpawnPoints;
|
||||
public List<Chemical> chemicalInstances = new();
|
||||
public MicrogamePotion[] allPotions;
|
||||
public MicrogamePotion currentPotion;
|
||||
public List<MicrogamePotion> requestedPotions = new();
|
||||
public List<MicrogamePotion> completedPotions = new();
|
||||
|
|
@ -31,7 +43,28 @@ public class MarisaPotionMaker : MicroGameHandler
|
|||
|
||||
public void StartPotion(MicrogamePotion potionRequested)
|
||||
{
|
||||
|
||||
currentPotion = potionRequested;
|
||||
foreach (Chemical requestedChemical in potionRequested.chemicals)
|
||||
{
|
||||
int index = Random.Range(0, chemicalSpawnPoints.Length);
|
||||
CreateChemical(requestedChemical,chemicalSpawnPoints[index].location);
|
||||
chemicalSpawnPoints[index].inUse = true;
|
||||
}
|
||||
foreach (ChemicalSpawnPoint spawnpoint in chemicalSpawnPoints)
|
||||
{
|
||||
if (spawnpoint.inUse)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
CreateChemical(allChemicals[Random.Range(0, allChemicals.Length)], spawnpoint.location);
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateChemical(Chemical chemicalRequested, Transform location)
|
||||
{
|
||||
Chemical newChemical = Instantiate(chemicalRequested, location.position, Quaternion.identity);
|
||||
newChemical.transform.SetParent(transform);
|
||||
chemicalInstances.Add(newChemical);
|
||||
}
|
||||
|
||||
private void Start()
|
||||
|
|
@ -60,6 +93,7 @@ public class MarisaPotionMaker : MicroGameHandler
|
|||
{
|
||||
CompletePotion(currentPotion, true);
|
||||
currentPotionIndex = 0;
|
||||
StartPotion(allPotions[Random.Range(0, allPotions.Length)]);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -71,6 +105,14 @@ public class MarisaPotionMaker : MicroGameHandler
|
|||
public void CompletePotion(MicrogamePotion potion, bool success)
|
||||
{
|
||||
requestedPotions.Remove(potion); //doesn't work if there's multiple of the same potion....
|
||||
foreach (Chemical chemicalInstance in chemicalInstances.ToArray())
|
||||
{
|
||||
if (chemicalInstance)
|
||||
{
|
||||
Destroy(chemicalInstance);
|
||||
}
|
||||
chemicalInstances.Remove(chemicalInstance);
|
||||
}
|
||||
if (success)
|
||||
{
|
||||
completedPotions.Add(potion);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue