Advertisement
Guest User

LevelData

a guest
Dec 13th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. [System.Serializable]
  5. public class Order {
  6. public bool hasDrink = false;
  7. public bool hasCheese = true;
  8. public bool hasTomato = false;
  9. public List<IngredientData> toppings;
  10. public int weight = 1;
  11. }
  12. [System.Serializable]
  13. public class CustomerData
  14. {
  15. public float basePatience;
  16. public List<Order> potentialOrders;
  17.  
  18. }
  19. [System.Serializable]
  20. public class Wave {
  21. public float basePatience = 40f;
  22. public List<Order> potentialOrders;
  23. public float timeToNextWave = 1f;
  24. public float customerSpawnInterval = 1f;
  25. public int normalCustomerCount;
  26. public List<CustomerData> startCustomers;
  27. public List<CustomerData> endCustomers;
  28. [HideInInspector]
  29. public List<CustomerData> customers;
  30. public void GenerateCustomers()
  31. {
  32. customers = new List<CustomerData>();
  33. for(int i = 0; i < startCustomers.Count; i++)
  34. {
  35. customers.Add(startCustomers[i]);
  36. }
  37. for(int i = 0; i < normalCustomerCount; i++)
  38. {
  39. CustomerData customerData = new CustomerData();
  40. customerData.basePatience = this.basePatience;
  41. customerData.potentialOrders = new List<Order>(potentialOrders);
  42.  
  43. customers.Add(customerData);
  44. }
  45. for (int i = 0; i < endCustomers.Count; i++)
  46. {
  47. customers.Add(endCustomers[i]);
  48. }
  49. }
  50. }
  51.  
  52. [CreateAssetMenu(fileName = "Data", menuName = "ScriptableObjects/LevelData", order = 1)]
  53. public class LevelData : ScriptableObject
  54. {
  55.  
  56. public float scoreOneStar, scoreTwoStar, scoreThreeStar = 0f;
  57. // score stuff
  58. public List<Wave> waves;
  59. public int GetCustomerCount()
  60. {
  61. int count = 0;
  62.  
  63. foreach(Wave wave in waves)
  64. {
  65. count += wave.startCustomers.Count;
  66. count += wave.endCustomers.Count;
  67. count += wave.normalCustomerCount;
  68. }
  69.  
  70. return count;
  71. }
  72.  
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement