// Start is called before the first frame update void Start() { // Grab the game manager manager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>(); Ingredient cabbage = ScriptableObject.CreateInstance <Ingredient>(); cabbage.ingredient_name = "Cabbage"; cabbage.ids = new int[3] { 999, 999, 999 }; cabbage.cost = 0; cabbage.effectsDict = new Dictionary <string, float[]>(); cabbage.effectsDict.Add("str", new float[2] { 0, 1 }); cabbage.effectsDict.Add("int", new float[2] { 3, 1 }); cabbage.effectsDict.Add("dex", new float[2] { 0, 1 }); cabbage.desc_string = "A simple cabbage."; cabbage.effect_string = IngredientGenerator.BuildEffectString(cabbage.effectsDict); cabbage.tags.Add(PartList.Part.Tags.plant); cabbage.sprite = Resources.Load <Sprite>("Sprites/Cabbage_Graphic"); quantity = 5 + GameObject.FindGameObjectWithTag("GameManager").GetComponent <PlayerDataManager>().day; AssignIngredient(cabbage, 10); }
protected void Start() { ingredient = gameObject.GetComponent <IngredientGenerator>(); obstacle = gameObject.GetComponent <ObstacleGenerator>(); lastGenerateSpot = startingItemRow * spawnDistanceUnit; lastDeltaTime = Time.time; }
private void Start() { // Get our shop tier tier = GameObject.FindGameObjectWithTag("GameManager").GetComponent <PlayerDataManager>().GetTierFromTag(shopTag); // Grab the ingredient Generator generator = GameObject.FindGameObjectWithTag("IngredientGenerator").GetComponent <IngredientGenerator>(); // Generate a group of appropriate unique ingredients generated = generator.GenerateIngredients(shopInventory.Length, shopTag, tier); quantities = generator.GetQuantities(shopTag); // Assign those ingredients to the shop's inventory for (int i = 0; i < shopInventory.Length; i++) { shopInventory[i] = generated[i]; } // Assign the ingredients to their respective storage for (int invSlot = 0; invSlot < inventory_obj.transform.childCount; invSlot++) { inventory_obj.transform.GetChild(invSlot).GetComponent <Storage>().AssignIngredient(shopInventory[invSlot], invSlot); inventory_obj.transform.GetChild(invSlot).GetComponent <Storage>().quantity = quantities[invSlot]; } }
// Start is called before the first frame update void Start() { // Grab all of our components generator = GameObject.FindGameObjectWithTag("IngredientGenerator").GetComponent <IngredientGenerator>(); handler = GetComponent <SaveFileHandler>(); player = GetComponent <PlayerDataManager>(); if (tooltip = GameObject.Find("Tooltip")) { tooltip.GetComponent <Tooltip>().HideTooltip(); } }
private void Start() { if (PhotonNetwork.IsMasterClient) { _ingredientPrefab = IngredientGenerator.GetInstance().GetRandomIngredient(); if (IsInstantiateAll) { GenerateIngredientsAll(); } else { GenerateIngredientAsync(); } } }
private void OnLevelWasLoaded(int level) { if (PersistenceScript.instance == transform.parent.GetComponent <PersistenceScript>()) { // Grab all of our components generator = GameObject.FindGameObjectWithTag("IngredientGenerator").GetComponent <IngredientGenerator>(); handler = GetComponent <SaveFileHandler>(); player = GetComponent <PlayerDataManager>(); if (tooltip = GameObject.Find("Tooltip")) { tooltip.GetComponent <Tooltip>().HideTooltip(); } player.RefreshInventory(); } }
private void Awake() { if (!PhotonNetwork.IsMasterClient && PhotonNetwork.IsConnected) { this.enabled = false; } else { // Check and Set Singleton Object if (_instance != null) { Debug.Log("IngredientGenerator : IngredientGenerator has Duplicated, Delete Another One"); gameObject.SetActive(false); } _instance = this; _ingredientPrefabListCache = IngredientPrefabList.ToArray(); } }