// Update is called once per frame void Update() { phaseDataList = GameObjectTracker.GetGOT()._PlayerData.Breathless.PhaseList; if (phaseDataList != null && phaseCount < phaseDataList.Count) { // if we have a data list, and the data list is greater than the number // of phases we have created, the last phasecount "Should" be the last // punched phase, grab that and create the result object and add it to the grid. BasePhase.PhaseData lastPhaseData = phaseDataList[phaseCount]; // after all is done, increment our phase count phaseCount++; FUIPhaseResultObject newPhaseResult = null; newPhaseResult = NGUITools.AddChild(myGrid.gameObject, refPhaseResultObject.gameObject).GetComponent <FUIPhaseResultObject>(); if (lastPhaseData.PhaseCompletionPunch < 0) { newPhaseResult.phaseSprite.spriteName = "phaseunknown"; newPhaseResult.phaseLabel.text = "Failed"; } else { newPhaseResult.phaseSprite.spriteName = lastPhaseData.IconTextureName; newPhaseResult.phaseLabel.text = FormatSeconds(lastPhaseData.PhaseCompletionPunch); //newPhaseResult.PhaseData = lastPhaseData; } // regardless if the phases is punched or not, store the given phase name // this way when it gets punched, we can update the data newPhaseResult.givenSpriteName = lastPhaseData.IconTextureName; phaseResults.Add(newPhaseResult); // now we've added any new phases that we need. // real quick iterate through the lists, and update any new phases that // have now been punched for (int i = 0; i < phaseCount; i++) { if (phaseDataList[i].PhaseCompletionPunch > 0) { phaseResults[i].phaseSprite.spriteName = phaseResults[i].givenSpriteName; phaseResults[i].phaseLabel.text = FormatSeconds(phaseDataList[i].PhaseCompletionPunch); phaseResults[i].PhaseData = phaseDataList[i]; } } myGrid.Reposition(); // update the phase title if (labelPhaseResultsTitle) { labelPhaseResultsTitle.text = phaseResultsTitles[phaseCount]; } } }
public void AddPhase(BasePhase.PhaseData data) { _infinteModeData.PhaseList.Add(data); }
// Update is called once per frame void Update() { phaseDataList = GameObjectTracker.GetGOT()._PlayerData.Breathless.PhaseList; if (Input.GetKeyDown(KeyCode.E)) { ActivateNotification(); } if (phaseCount > 0 && phaseDataList.Count < 1) { Debug.LogError("CLEAR!"); phaseCount = 0; foreach (FUIPhaseBadgeObject o in phaseBadges) { DestroyImmediate(o.gameObject); } phaseBadges.Clear(); } if (phaseDataList != null && phaseCount < phaseDataList.Count) { BasePhase.PhaseData lastPhaseData = phaseDataList[phaseCount]; FUIPhaseBadgeObject newBadge = NGUITools.AddChild(myGrid.gameObject, refPhaseBadgeObject.gameObject).GetComponent <FUIPhaseBadgeObject>(); newBadge.givenSpriteName = lastPhaseData.IconTextureName; phaseBadges.Add(newBadge); //Set the current badge CurrentPhaseIcon.spriteName = phaseDataList[phaseCount].IconTextureName; //Play the incomming animation. CounterIconAnimation.Reset(); CounterIconAnimation.Play(true); phaseCount++; myGrid.Reposition(); } for (int i = 0; i < phaseCount; i++) { if (phaseBadges[i].mySprite) { phaseBadges[i].mySprite.spriteName = phaseBadges[i].givenSpriteName; Color spriteColor = phaseBadges[i].mySprite.color; if (phaseDataList[i].PhaseCompletionPunch > 0) { spriteColor.a = 1f; if (!phaseBadges[i].Used) { phaseBadges[i].Used = true; NotificationSprite.spriteName = phaseBadges[i].mySprite.spriteName; CounterText.text = " " + phaseDataList[i].ComboToComplete + " "; ActivateNotification(); } if (phaseBadges[i].mySprite) { phaseBadges[i].mySprite.color = spriteColor; } } else { spriteColor.a = 0.0f; if (phaseBadges[i].mySprite) { phaseBadges[i].mySprite.color = spriteColor; } } } } //Do the CC health here.. if (ToyBox.GetPandora().CommandCenter_01) { float ccHealth = ToyBox.GetPandora().CommandCenter_01.GetHealthPercentage(); float range = CCmax - CCMin; float scale = range * ccHealth; float size = CCMin + scale; //Scale the position of the panel clip based on % of CC Health. CCHealthPanel.clipRange = new Vector4(size, 15.0f, 300.0f, 50.0f); //Check for greater than so only play the animation if we are loosing health over time. if (previousCCHealth > ccHealth) { HealthAnimation.Reset(); HealthAnimation.Play(true); previousCCHealth = ccHealth; } //handle warning. if (ccHealth > WarningPercent) { //Set the bg color to normal. TopBarBG.gameObject.SetActive(false); return; } if (ccHealth < WarningPercent && !TopBarBG.gameObject.activeSelf) { //activate teh animation. TopBarBG.gameObject.SetActive(true); WarningTopBar.Reset(); WarningTopBar.Play(true); AudioPlayer.GetPlayer().PlayMenuSFX(AudioPlayer.MenuSFX.CCWarning); return; } } }