private void GameOver() { Countdown.onComplete -= GameOver; start = false; grade = Quality.CalculateGradeFromPoints(PointsManager.GetPoints()); PointsManager.onFinishLeveling += () => { GemSpawnManager.UpgradeGem(grade); PointsManager.gameObject.SetActive(false); GradeText.text = Quality.GradeToString(grade); GradeText.color = Quality.GradeToColor(grade); GradeText.gameObject.SetActive(true); SFX.Play(Quality.ReturnSFXName(grade), 1f, 1f, 0f, false, 0f); }; PointsManager.DoEndGameTransition(); foreach (NewCutPoint cut in activeCuts) { Destroy(cut.gameObject); } ShowUIButtons(); }
private void GameOver() { StopCoroutine(CalculateSwipes(false)); Countdown.onComplete -= GameOver; //if (gameOver) { //CalculateGrade(); gameOver = true; var tmpGrade = Quality.CalculateGradeFromPoints(pointsManager.GetPoints()); pointsManager.onFinishLeveling += () => { GemSpawnManager.UpgradeGem(tmpGrade); pointsManager.gameObject.SetActive(false); qualityText.text = Quality.GradeToString(tmpGrade); qualityText.color = Quality.GradeToColor(tmpGrade); qualityText.gameObject.SetActive(true); SFX.Play(Quality.ReturnSFXName(tmpGrade), 1f, 1f, 0f, false, 0f); }; pointsManager.DoEndGameTransition(); // Combine grade at the end for when we return to shop. grade = Quality.CalculateCombinedQuality(GameManager.Instance.QualityTransfer, tmpGrade); ShowUIButtons(); }
private void GameOver() { Countdown.onComplete -= GameOver; var tmpGrade = Quality.CalculateGradeFromPoints(PointsManager.GetPoints()); PointsManager.onFinishLeveling += () => { brickSpawnmanager.Upgrade(tmpGrade); PointsManager.gameObject.SetActive(false); qualityText.text = Quality.GradeToString(tmpGrade); qualityText.color = Quality.GradeToColor(tmpGrade); qualityText.gameObject.SetActive(true); SFX.Play(Quality.ReturnSFXName(tmpGrade), 1f, 1f, 0f, false, 0f); }; feedbackParticleSystem.GetComponent <ParticleSystem>().Stop(); PointsManager.DoEndGameTransition(); FollowSphere.SetActive(false); _currentRuneSprite.SetActive(false); ResetOptimalPoints(); grade = Quality.CalculateCombinedQuality(GameManager.Instance.QualityTransfer, tmpGrade); ShowUIButtons(); _dataBase.HideUI(); _canTrace = false; }
// Change this to be dependent on shonky type + shonky grade. public void InfluencePersonality(Quality.QualityGrade grade, float basePrice) { // TODO: don't hardcode this. MultiplyPersonality(basePrice); switch (grade) { case Quality.QualityGrade.Junk: MultiplyPersonality(0.1f); break; case Quality.QualityGrade.Brittle: MultiplyPersonality(0.75f); break; case Quality.QualityGrade.Passable: MultiplyPersonality(1.0f); break; case Quality.QualityGrade.Sturdy: MultiplyPersonality(1.15f); break; case Quality.QualityGrade.Magical: MultiplyPersonality(1.3f); break; case Quality.QualityGrade.Mystic: MultiplyPersonality(1.5f); break; default: break; } }
public CarPartInstance(Item item, int quantity, Quality.QualityGrade quality, bool isNew) { this.item = item; this.quantity = quantity; this.quality = quality; this.isNew = isNew; }
public void PlayRelevantQualitySFX(Quality.QualityGrade grade) { Debug.Log("Playing grade sound " + grade); switch (grade) { case Quality.QualityGrade.Junk: SFX.Play("Game_Quality_Junk", 1f, 1f, 0f, false, 0f); break; case Quality.QualityGrade.Brittle: SFX.Play("Game_Quality_Brittle", 1f, 1f, 0f, false, 0f); break; case Quality.QualityGrade.Passable: SFX.Play("Game_Quality_Passable", 1f, 1f, 0f, false, 0f); break; case Quality.QualityGrade.Sturdy: SFX.Play("Game_Quality_Sturdy", 1f, 1f, 0f, false, 0f); break; case Quality.QualityGrade.Magical: SFX.Play("Game_Quality_Magical", 1f, 1f, 0f, false, 0f); break; case Quality.QualityGrade.Mystic: SFX.Play("Game_Quality_Mystic", 1f, 1f, 0f, false, 0f); break; } }
public ItemInstance(string itemName, int quantity, Quality.QualityGrade quality, bool isNew) { this.ItemIdentifier = itemName; this.Quantity = quantity; this.Quality = quality; this.IsNew = isNew; _item = ((ItemDatabase)Resources.Load("ItemDatabase")).GetActual(ItemIdentifier); }
private void Reset() { currentGrade = StartingGrade; TextCurrentLevel.text = Quality.GradeToString(currentGrade); TextCurrentLevel.color = Quality.GradeToColor(currentGrade); foregroundImage.color = Quality.GradeToColor(currentGrade); fillAmount = 0; foregroundTransform.DOComplete(); UpdateFillAmount(); }
private IEnumerator ShowText(string gemType, Quality.QualityGrade grade, PenSlot slot, GameObject golemObj) { golemText.enabled = true; golemBottomText.enabled = true; golemText.text = string.Format("New {0} {1} Golem!", grade, gemType); golemText.color = Quality.GradeToColor(grade); golemBottomText.color = Quality.GradeToColor(grade); yield return(new WaitForSeconds(3f)); golemObj.transform.DOMove(slot.transform.position, 1f, false).OnComplete(() => RestartGolem(golemObj)); //Need to show golem schematic TutorialProgressChecker.Instance.UpdateItemStatus("Golem", TutorialProgressChecker.ImageStatus.JustAchieved); TutorialProgressChecker.Instance.ShowCanvas(true); }
private void Start() { //BackgroundImage = Background.GetComponent<Image>(); BackgroundTransform = Background.GetComponent <RectTransform>(); foregroundImage = Foreground.GetComponent <Image>(); foregroundTransform = Foreground.GetComponent <RectTransform>(); // Get quality grades for shop level 3. grades = new LinkedList <Quality.QualityGrade>(Quality.GetPossibleGrades(3)); // Pop the current grade. //currentGrade = grades.First.Value; currentGrade = StartingGrade; //grades.RemoveFirst(); // Initialize with details. TextCurrentLevel.text = Quality.GradeToString(currentGrade); TextCurrentLevel.color = Quality.GradeToColor(currentGrade); foregroundImage.color = Quality.GradeToColor(currentGrade); fillAmount = StartFill; // POSITIONING FOREGROUND BAR. // Foreground bar min/max derived from the background. // These are inverted from what you would expect because of Unity anchors. // barMaxWidth = 0.0 -> barMinWidth = 1.0; barHeight = BackgroundTransform.rect.height - Padding * 2f; barMaxWidth = Padding * 2f; barMinWidth = BackgroundTransform.rect.width + Padding * 2f; // Position the middle of the bar correctly in almost all circumstances. Vector3 pos = foregroundTransform.anchoredPosition; //pos.x = -Padding; pos.x = Padding; foregroundTransform.anchoredPosition = pos; // Fill initial correctly. //foregroundTransform.sizeDelta = new Vector2(-barMaxWidth, barHeight); float fill = -Mathf.Lerp(barMinWidth, barMaxWidth, fillAmount); foregroundTransform.sizeDelta = new Vector2(fill, barHeight); // Subscribe to countdown tick. Countdown.onTick += SubtractFixed; }
private IEnumerator ShowText(string gemType, Quality.QualityGrade grade, PenSlot slot, GameObject golemObj) { golemText.enabled = true; golemBottomText.enabled = true; golemText.text = string.Format("New {0} {1} Golem!", grade, gemType); golemText.color = Quality.GradeToColor(grade); golemBottomText.color = Quality.GradeToColor(grade); yield return(new WaitForSeconds(3f)); if (golemObj != null) { golemObj.transform.DOMove(slot.transform.position, 1f, false).OnComplete(() => RestartGolem(golemObj)); } else { RestartGolem(null); } }
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 GameOver() { Countdown.onComplete -= GameOver; start = false; grade = Quality.CalculateGradeFromPoints(pointsManager.GetPoints()); feedbackParticleSystem.Stop(); pointsManager.onFinishLeveling += () => { OreSpawnManager.Upgrade(grade); pointsManager.gameObject.SetActive(false); qualityText.text = Quality.GradeToString(grade); qualityText.color = Quality.GradeToColor(grade); qualityText.gameObject.SetActive(true); SFX.Play(Quality.ReturnSFXName(grade), 1f, 1f, 0f, false, 0f); }; pointsManager.DoEndGameTransition(); ShowUIButtons(); }
public static void Return(string itemString, Quality.QualityGrade grade) { //SFX.Play("sound"); Debug.Log("grade is " + grade); if (!GameManager.Instance.InTutorial) { if (grade != Quality.QualityGrade.Junk) { Inventory.Instance.InsertItem(new ItemInstance(itemString, 1, grade, true)); } Initiate.Fade("Shop", Color.black, 2f); } else { Inventory.Instance.InsertItem(new ItemInstance(itemString, 1, grade, true)); TutorialProgressChecker.Instance.FinishedComponent(itemString); Initiate.Fade("TutorialShop", Color.black, 2f); } }
public void Upgrade(Quality.QualityGrade grade) { TracingSceneBrick.SetActive(false); if (grade == Quality.QualityGrade.Junk) { var clone = Instantiate(SmokeParticleSystem, SmokePosition, Quaternion.Euler(RotationOverrideSmoke), transform); clone.transform.localScale = new Vector3(ScaleOverrideSmoke, ScaleOverrideSmoke, ScaleOverrideSmoke); } else { var clone = Instantiate(SmokeParticleSystem, SmokePosition, Quaternion.Euler(RotationOverrideShine), transform); clone.transform.localScale = new Vector3(ScaleOverrideSmoke, ScaleOverrideSmoke, ScaleOverrideSmoke); clone = Instantiate(ShineParticleSystem, ShinePosition, Quaternion.Euler(RotationOverrideShine), transform); clone.transform.localScale = new Vector3(ScaleOverrideShine, ScaleOverrideShine, ScaleOverrideShine); clone = Instantiate(Shell, AfterPosition, Shell.transform.rotation, transform); //clone.transform.localScale = new Vector3(ScaleOverrideShell, ScaleOverrideShell, ScaleOverrideShell); } }
// Moves to the next quality level in the queue. If none is available, returns false. private bool MoveDownQualityLevel(float spare = 0f) { if (currentGrade == grades.Last.Value) { return(false); } // Update the current grade. var current = grades.Find(currentGrade); if (current == null || current.Next == null) { return(false); } currentGrade = current.Next.Value; TextCurrentLevel.text = Quality.GradeToString(currentGrade); TextCurrentLevel.color = Quality.GradeToColor(currentGrade); foregroundImage.color = Quality.GradeToColor(currentGrade); foregroundTransform.DOComplete(); fillAmount = 1f; // - spare; UpdateQualityBar(Ease, LevelChangeEaseTime); Subtract(spare); //float fill = -Mathf.Lerp(barMinWidth, barMaxWidth, fillAmount); //foregroundTransform.sizeDelta = new Vector2(fill, barHeight); //Original SFX //SFX.Play("quality_bar_deplete"); //New SFX entered on 27/8/18 by Pierre SFX.Play("Mini_Game_Quality_loss", 1f, 1f, 0f, false, 0f); return(true); }
// Moves to the next quality level in the queue. If none is available, returns false. private bool MoveUpQualityLevel(float spare = 0f) { if (grades.Count == 5) { return(false); } // Update the current grade. var current = grades.Find(currentGrade); //Debug.Log(subsequent.Value + " next grade"); if (current == null || current.Previous == null) { return(false); } currentGrade = current.Previous.Value; //Debug.Log("current grade is " + currentGrade); TextCurrentLevel.text = Quality.GradeToString(currentGrade); TextCurrentLevel.color = Quality.GradeToColor(currentGrade); foregroundImage.color = Quality.GradeToColor(currentGrade); foregroundTransform.DOComplete(); fillAmount = 0f; UpdateFillAmount(); //UpdateQualityBar(Ease, LevelChangeEaseTime); //Add(spare); //float fill = -Mathf.Lerp(barMinWidth, barMaxWidth, fillAmount); //foregroundTransform.sizeDelta = new Vector2(fill, barHeight); // SFX.Play("??"); //New SFX placed by Pierre 27/8/18 SFX.Play("Mini_Game_Quality_gain", 1f, 1f, 0f, false, 0f); return(true); }
public void UpgradeGem(Quality.QualityGrade grade) { // If grade is junk, don't instantiate everything. if (grade == Quality.QualityGrade.Junk) { Instantiate(SmokeParticleSystem, SmokePosition, Quaternion.identity, transform); // Setting inactive is faster. We'll probably pay for the whole destroy cost in loading anyway though. spawnedClone.SetActive(false); } else { Instantiate(SmokeParticleSystem, SmokePosition, Quaternion.identity, transform); Instantiate(ShineParticleSystem, ShinePosition, Quaternion.identity, transform); //Destroy(spawnedClone); // Setting inactive is faster. We'll probably pay for the whole destroy cost in loading anyway though. spawnedClone.SetActive(false); //Instantiate(cloneAfter, cloneAfter.transform.position, cloneAfter.transform.rotation, transform); Instantiate(cloneAfter, AfterGemPosition, cloneAfter.transform.rotation, transform); } }
private void FinaliseCombination(Slot current, Slot slot) { StopAllCoroutines(); string 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); //Move new golem to pen pSlot.SetItemInstantiated(newGolem, clone); toolbox.ClearGolemCreation(slot); StartCoroutine(ShowText(gem, avg, pSlot, clone)); } }
public void Upgrade(Quality.QualityGrade grade) { if (grade == Quality.QualityGrade.Junk) { var a = Instantiate(SmokeParticleSystem, SmokePosition, Quaternion.identity, transform); a.transform.localScale = new Vector3(ScaleOverrideSmoke, ScaleOverrideSmoke, ScaleOverrideSmoke); spawnedClone.SetActive(false); //SmeltingPot.SetActive(false); } else { Instantiate(Brick, AfterPosition, Brick.transform.rotation, transform); var a = Instantiate(SmokeParticleSystem, SmokePosition, Quaternion.identity, transform); a.transform.localScale = new Vector3(ScaleOverrideSmoke, ScaleOverrideSmoke, ScaleOverrideSmoke); a = Instantiate(ShineParticleSystem, ShinePosition, Quaternion.identity, transform); a.transform.localScale = new Vector3(ScaleOverrideShine, ScaleOverrideShine, ScaleOverrideShine); spawnedClone.SetActive(false); //SmeltingPot.SetActive(false); //Debug.Log("Was success" + success); } }
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)); } } }
public PointQuality(Quality.QualityGrade grade, float percentage) { this.grade = grade; this.percentage = percentage; }
public ItemInstance(Item item, Quality.QualityGrade quality) { this.item = item; this.quality = quality; }
// Use this for initialization void Start() { SFX.Play("BiddingTrack", 1f, 1f, 0f, true, 0f); if (GameManager.Instance.ActiveGameMode == GameMode.Story) { Countdown.onComplete += GameOver; } else if (GameManager.Instance.ActiveGameMode == GameMode.Party) { Countdown.onComplete += GameOverParty; } // If no golem has been transfered (maybe we're launching directly from the scene), then use a default. // otherwise, use the golem which was transfered. ItemInstance tmp; if (ShonkyInventory.Instance != null && ShonkyInventory.Instance.GetItem(GameManager.Instance.ShonkyIndexTransfer, out tmp)) { golem = tmp; golemQuality = golem.Quality; } else { Debug.LogWarning("Shonky index was not transfered, is incorrect, or ShonkyInventory not initialized. Will use default Shonky."); golem = new ItemInstance("rubygolem1", 1, Quality.QualityGrade.Sturdy, false); golemQuality = golem.Quality; } golemClone = Instantiate(golem.item.physicalRepresentation, GolemSpawnPoint.transform.position, GolemSpawnPoint.transform.rotation, GolemSpawnPoint.transform); //golemClone = Instantiate(golem.item.physicalRepresentation, GolemSpawnPoint.transform); golemClone.GetComponent <Rigidbody>().isKinematic = true; // If no wizard has been transfered, use a default. // otherwise, use the wizard which was transfered. GameObject wizardPrefab; int index; string name = GameManager.Instance.WizardTransfer; if (!string.IsNullOrEmpty(name) && (index = NPCNames.IndexOf(name)) >= 0) { wizardPrefab = NPCPrefabs[index]; } else { Debug.LogWarning("Wizard was not transfered or is incorrect. Will use default wizard."); wizardPrefab = NPCPrefabs[0]; } // This isn't a walking NPC, so disable the walking script. If we don't we'll have errors about detecting spawn point. wizardClone = Instantiate(wizardPrefab, WizardSpawnPoint.transform); wizardClone.GetComponent <NPCWalker>().enabled = false; wizardClone.GetComponent <NPC>().ShowFront(); wizardClone.GetComponent <NPC>().FrontIdle(); /* * if (GameManager.Instance.SpriteTransfer != null) { * WizardRenderer.sprite = GameManager.Instance.SpriteTransfer; * } else { * Debug.LogWarning("Wizard sprite was not transfered, will use defaut."); * } */ // Build a dictionary based on the list, which is easier for code to use. //SegmentInfosDict = BuildDictionary(SegmentInfos); // TODO: this isn't very obvious, is there a better way? RadialBar.DefaultColor = SegmentInfoDict[Segment.Ok].Color; price = PriceInfoDict[golemQuality]; PriceText.text = "Price: <sprite=0>" + price; c = PriceText.color; GeneratePoints(); }