Add Delivery Manager UI and UI logic

This commit is contained in:
BuyMyMojo 2023-03-03 03:54:19 +11:00
parent 8c5f4f2acf
commit 3ec46256e8
89 changed files with 14001 additions and 12 deletions

View file

@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -5,6 +6,8 @@ using UnityEngine;
public class DeliveryManager : MonoBehaviour
{
public event EventHandler OnRecipeSpawned;
public event EventHandler OnRecipeCompleted;
public static DeliveryManager Instance { get; private set; }
[SerializeField] private RecipeListSO recipeListSO;
@ -30,11 +33,11 @@ public class DeliveryManager : MonoBehaviour
if (waitingRecipeSOList.Count < waitingRecipesMax)
{
RecipeSO waitingRecipeSO = recipeListSO.recipeSOList[Random.Range(0, recipeListSO.recipeSOList.Count)];
Debug.Log(waitingRecipeSO.recipeName);
RecipeSO waitingRecipeSO = recipeListSO.recipeSOList[UnityEngine.Random.Range(0, recipeListSO.recipeSOList.Count)];
waitingRecipeSOList.Add(waitingRecipeSO);
OnRecipeSpawned?.Invoke(this, EventArgs.Empty);
}
}
}
@ -81,6 +84,8 @@ public class DeliveryManager : MonoBehaviour
waitingRecipeSOList.RemoveAt(i);
OnRecipeCompleted?.Invoke(this, EventArgs.Empty);
return;
}
}
@ -92,4 +97,9 @@ public class DeliveryManager : MonoBehaviour
Debug.Log("Player brought the wrong recipe!");
}
public List<RecipeSO> GetWaitingRecipeSOList()
{
return waitingRecipeSOList;
}
}