private void Update() { if (CookingHandler.Ongoing && !InRange()) { CookingHandler.ForceClose(); } }
private void Update() { if (currentOpenCookingEntity != this) { return; } if (CookingHandler.Ongoing && !InRange()) { CookingHandler.ForceClose(); } }
public void Interact() { if (!CanCook()) { return; } var displayPosition = StovePosition; displayPosition.y += verticalDisplayOffset; CookingHandler.ToggleView(Camera.main.WorldToViewportPoint(displayPosition), !cookingCanceled); interactionRange = Mathf.Clamp(Vector2.Distance(StovePosition, GameLibOfMethods.player.transform.position), minimumInteractionRange, float.MaxValue); }
public void LoadGame() { #if UNITY_EDITOR && ODIN_SUPPORTED // Specific so game won't save/load for Lyrcaxis if (!UnityEditor.EditorPrefs.GetBool("ShouldGameSave", true)) { Debug.Log("Not Loading :)"); return; } #endif if (CurrentSaveData != null) { PlayTime = CurrentSaveData.RealPlayTime; GameLibOfMethods.player.transform.localPosition = new Vector3(CurrentSaveData.playerX, CurrentSaveData.playerY, 1); GameTime.Clock.SetTime(CurrentSaveData.time); GameTime.Calendar.Initialize(CurrentSaveData.days, CurrentSaveData.weekday, CurrentSaveData.season); Weather.WeatherSystem.Initialize(CurrentSaveData.weather); Stats.SetMoney = CurrentSaveData.money; Bank.Instance.MoneyInBank = (float)CurrentSaveData.moneyInBank; Bank.Instance.PercentagePerDay = CurrentSaveData.percentagePerDay; Bank.Instance.UpdateBalance(); Stats.XpMultiplier = CurrentSaveData.xpMultiplayer; Stats.PriceMultiplier = CurrentSaveData.priceMultiplayer; Stats.RepairSpeed = CurrentSaveData.repairSpeed; SpriteControler.Instance.visuals = CurrentSaveData.characterVisuals.GetVisuals(); Inventory.Initialize(CurrentSaveData.inventoryItems, CurrentSaveData.containerItems); JobManager.JobData = CurrentSaveData.job; Stats.Initialize(CurrentSaveData.playerSkillsData, CurrentSaveData.playerStatusData); if (CurrentSaveData.CompletedMissions != null) { MissionHandler.CompletedMissions = new List <string>(CurrentSaveData.CompletedMissions); } if (CurrentSaveData.CurrentMissions != null) { MissionHandler.CurrentMissions = new List <string>(CurrentSaveData.CurrentMissions); } MissionHandler.missionHandler.ReactivateOld(); //henrique - working on the save system //Debug.LogWarning("Upgrades not loading."); //Upgrades.SetData(CurrentSaveData.upgrades); if (CurrentSaveData.upgrades != null) { StartCoroutine(LoadUpgrades(CurrentSaveData)); } HomePCInteractions.instance.savedProgress = CurrentSaveData.computerActivitiesProgress; CookingHandler.SetCookedRecipes(CurrentSaveData.cookedRecipes); CareerUi.Instance.UpdateJobUi(); } else if (Stats.Ready) //Loaded directly from game scene { Stats.Initialize(); Inventory.Initialize(); CookingHandler.SetCookedRecipes(null); CareerUi.Instance.UpdateJobUi(); } onPlay = true; StatusUIUpdater.UpdateEverything(); }
private IEnumerator <float> StartCooking(List <ItemList.ItemInfo> itemsToCook) { cookData.itemsToCook = itemsToCook; isCooking = true; fryingPan.SetActive(false); CookingHandler.ForceClose(); GameLibOfMethods.canInteract = false; GameLibOfMethods.cantMove = true; GameLibOfMethods.Walking = true; SpriteControler.Instance.FaceUP(); GameLibOfMethods.animator.SetBool("Cooking", true); UIManager.Instance.ActionText.text = "Cooking"; float timeLapse = cookingCanceled ? cookData.timeLapse : 0; cookingEXP = cookingCanceled ? cookData.exp : 10f; while (timeLapse < timeToCook) { timeLapse += Time.deltaTime; GameLibOfMethods.progress = timeLapse / timeToCook; if (Input.GetKeyUp(KeyCode.E) || Input.GetKeyUp(KeyCode.Escape)) { resumeCooking = false; cookingCanceled = true; cookData.exp = cookingEXP; cookData.timeLapse = timeLapse; break; } if (Stats.Status(Type.Energy).CurrentAmount <= 0 || Stats.Status(Type.Health).CurrentAmount <= 0) { break; } yield return(0f); } GameTime.Clock.ChangeSpeed(5); fryingPan.SetActive(true); yield return(0f); isCooking = false; GameLibOfMethods.progress = 0; PlayerAnimationHelper.ResetPlayer(); if (Stats.Status(Type.Energy).CurrentAmount <= 0 || Stats.Status(Type.Health).CurrentAmount <= 0) { yield return(0f); GameLibOfMethods.animator.SetBool("PassOut", true); } else if (resumeCooking || !cookingCanceled) { Stats.AddXP(Skill.Type.Cooking, cookingEXP); yield return(0f); CookingHandler.AddCookedRecipes(itemsToCook); Inventory.PlaceOnBag(itemsToCook); if (itemsToCook.Count > 0) { lastCookItem = itemsToCook[itemsToCook.Count - 1].itemCode; } yield return(0f); cookingCanceled = false; resumeCooking = false; cookData.Reset(); } }