public static void AddGorenganToWajan(Gorengan gorengan) { bool isAvailable = false; CookingItem item = GameManagement.CookingItems.Find(x => x.UsageTool == Usage.cooking); foreach (Transform obj in GameManagement.ToolObjectParent.transform) { ToolAction tool_a = obj.GetComponent <ToolAction>(); if (item.Level >= tool_a.UnlockLevel && tool_a.UsageFor == Usage.cooking) { Wajan tool = tool_a.tool as Wajan; Debug.Log("wajan level : " + item.Level + ", requirement : " + tool_a.UnlockLevel + ", status empty : " + tool.Status()); if (tool != null && tool.Status() == FryingStatus.empty) { GameManagement.Player.ReduceMoney(gorengan.Cost); tool.Use(gorengan); isAvailable = true; break; } } } if (!isAvailable) { GameManagement.WarningText = "Wajan is Full"; } }
public void SelectRecipe() { //Debug.Log(EventSystem.current.currentSelectedGameObject.name); Gorengan gorengan = GameManagement.Gorengans.Find(x => x.ids == buttonAction); Player player = GameManagement.Player; if (gorengan != null && player.Money > gorengan.Cost) { Wajan.AddGorenganToWajan(gorengan); //GameManagement.Player.ReduceMoney(gorengan.Cost); --moved to wajan.cs supaya kalau wajannya penuh, duit ga kurang. } else if (gorengan != null && player.Money < gorengan.Cost) { GameManagement.WarningText = "Don't Have enough money to cook"; } }