//Method to Update achievements backend private void UpdateAchievements() { string gemType = GameManager.Instance.typeOfTrueGolem; //Trigger dialogue by updating achievements switch (GameManager.Instance.typeOfTrueGolem) { case "EmeraldGolem1": NarrativeManager.Read("true_emerald_speech"); //gemType = "emerald"; break; case "AmethystGolem1": NarrativeManager.Read("true_amethyst_speech"); //gemType = "amethyst"; break; case "RubyGolem1": NarrativeManager.Read("true_ruby_speech"); //gemType = "ruby"; break; case "SapphireGolem1": NarrativeManager.Read("true_sapphire_speech"); //gemType = "sapphire"; break; default: NarrativeManager.Read("true_ruby_speech"); //gemType = "ruby"; break; } //Unlock relevant true golem in inventory so it appears in future visits to the hall Inventory.Instance.UnlockTrueGolem(TrueGolems.GemStringToGolem(gemType)); //Depending on the number of true golems created, may need to trigger game end sequence List <TrueGolems.TrueGolem> golemsUnlocked = Inventory.Instance.GetUnlockedTrueGolems(); if (golemsUnlocked.Count < 4) { //onClose of dialogue, reset relevant variables and allow player to move camera back to start (auto set right now) PopupTextManager.onClose += () => FinishSequence(); } else { //Transition to the game ending PopupTextManager.onClose += () => FinishGame(); } }
//Unlock method public void UnlockTrueGolem(TrueGolems.TrueGolem golem) { if (TrueGolems.PotentialUnlockTrueGolem(golem)) { Debug.Log("Unlocking true golem " + golem); CheckTrueGolemInitialisation(); Debug.Log("Adding new True Golem"); unlockedTrueGolems.Add(golem); AchievementManager.Get("true_golem_01"); AchievementManager.Increment("true_golem_02"); PersistentData.Instance.Save(); Save(); } }
public bool CheckIfTrueGolem(ItemInstance item) { if (!GameManager.Instance.InTutorial) { if (item.item.GetType() == typeof(Shonky)) { Quality.QualityGrade golemQuality = item.Quality; if (golemQuality == Quality.QualityGrade.Mystic) { string gemType = (item.item as Shonky).type.ToString(); if (TrueGolems.PotentialUnlockTrueGolem(TrueGolems.GemStringToGolem(gemType))) { return(true); } } } } return(false); }
private void UnlockTrueGolem(ItemInstance item) { string gemType = (item.item as Shonky).type.ToString(); Inventory.Instance.UnlockTrueGolem(TrueGolems.GemStringToGolem(gemType)); }
private void FinaliseCombination(Slot current, Slot slot) { StopAllCoroutines(); gemType = toolbox.FindGemType(current, slot); int index1, index2; index1 = current.index; index2 = slot.index; //SFX.Play("golem_created"); Debug.Log("Created Golem"); //Get the average quality of the shell and charged gem, assign to new golem. Quality.QualityGrade item1 = current.itemInstance.Quality; Quality.QualityGrade item2 = slot.itemInstance.Quality; Quality.QualityGrade avg = Quality.CalculateCombinedQuality(item1, item2); ItemInstance newGolem = new ItemInstance(gemType, 1, avg, true); string gem = (newGolem.item as Shonky).type.ToString(); int index = ShonkyInventory.Instance.InsertItem(newGolem); if (index != -1) { Quaternion rot = Quaternion.Euler(obj1Rotation); PenSlot pSlot = physicalShonkyInventory.GetSlotAtIndex(index); GameObject clone = Instantiate(newGolem.item.physicalRepresentation, desiredPosition.transform.position, rot); clone.GetComponent <ShonkyWander>().enabled = false; clone.GetComponent <NavMeshAgent>().enabled = false; clone.GetComponent <Rigidbody>().useGravity = false; Inventory.Instance.RemoveItem(index1); Inventory.Instance.RemoveItem(index2); //Reset Variables in toolbox and remove held references to deleted objects pSlot.SetItemInstantiated(newGolem, clone); toolbox.ClearGolemCreation(slot); //If a true golem, do narrative handling if (newGolem.Quality == Quality.QualityGrade.Mystic) { Debug.Log("gem type is " + gemType); // NOTE: gemType == "RubyGolem1", but GemStringToGolem checks for "ruby"? if (TrueGolems.PotentialUnlockTrueGolem(TrueGolems.GemStringToGolem(gemType))) { //Show relevant dialogue based on amount of true golems previously made List <TrueGolems.TrueGolem> golemsUnlocked = Inventory.Instance.GetUnlockedTrueGolems(); //Need to get boolean to handle if the narrative is not necessary. bool gizmo; switch (golemsUnlocked.Count) { case 0: gizmo = NarrativeManager.Read("true_golem_01"); break; case 1: gizmo = NarrativeManager.Read("true_golem_02"); break; case 2: gizmo = NarrativeManager.Read("true_golem_03"); break; case 3: gizmo = NarrativeManager.Read("true_golem_04"); break; default: gizmo = false; break; } Debug.Log("Gizmo is " + gizmo); if (!gizmo) { PopupTextManager.onClose += () => TransitionToHall(); //Instantiate glow on golem and make it dance glowObject = Instantiate(glowParticle, clone.transform); glowObject.transform.localPosition = new Vector3(0f, 0f, 0f); glowObject.transform.localScale = new Vector3(1f, 1f, 1f); clone.GetComponent <Animator>().Play("Dance"); //Remove golem from golem inventory as the player does not receive one when first creating a true golem ShonkyInventory.Instance.RemoveItem(index); } else { Inventory.Instance.UnlockTrueGolem(TrueGolems.GemStringToGolem(gemType)); StartCoroutine(ShowText(gem, avg, pSlot, clone)); } } else { StartCoroutine(ShowText(gem, avg, pSlot, clone)); } } else { StartCoroutine(ShowText(gem, avg, pSlot, clone)); } } }