Ejemplo n.º 1
0
    public void Setup(string playerId, int position, float score, Color color)
    {
        this.playerId = playerId;
        time          = score;

        this.score.text = score <= 0 ? "--:--:--.--" : HUD_TimeAttack.FormatTime(score);

        SetPosition(position);

        this.username.text = playerId;

        foreach (Image image in images)
        {
            image.color = color;
        }

        for (int i = 0; i != images.Length; ++i)
        {
            Color c = color;
            c.a             = originalAlpha[i];
            images[i].color = c;
        }

        LoadUserProfile();
        SetupClone(color);
        enabled = clone != null;
    }
Ejemplo n.º 2
0
    public void Setup(float companyRecord, float localRecord, int localCollectibles, int totalCollectibles)
    {
        companyRecordText.text = HUD_TimeAttack.FormatTime(companyRecord);
        localRecordText.text   = localRecord <= 0 ? "--:--:--.--" : HUD_TimeAttack.FormatTime(localRecord);
        recordAnimator.SetBool("Enabled", localRecord > 0 && localRecord < companyRecord);

        collectiblesText.text = localCollectibles.ToString("00") + "/" + totalCollectibles.ToString("00");
    }
Ejemplo n.º 3
0
    public void Show(string level, bool preloadScene)
    {
        ResetSelectFirst();
        SelectFirstButton();
        NextScene      = level;
        isPreloadScene = preloadScene;
        klausGear.SetActive(false);
        k1Gear.SetActive(false);

        // Turn on proper players
        GameObject[] players = GameObject.FindGameObjectsWithTag("Player");

        for (int i = 0; i != players.Length; ++i)
        {
            if (players[i].name.Contains("Klaus"))
            {
                klausGear.SetActive(true);
            }
            else if (players[i].name.Contains("K1"))
            {
                k1Gear.SetActive(true);
            }
        }

        // Turn on black line content
        HUD_TimeAttack hudTimeAttack = GameObject.FindObjectOfType <HUD_TimeAttack>();

        if (hudTimeAttack == null || !hudTimeAttack.ShowLevelCompleted())
        {
            timePanel.SetActive(false);
            quoteText.gameObject.SetActive(true);
        }
        else
        {
            timePanel.SetActive(true);
            quoteText.gameObject.SetActive(false);
        }

        // Check if K1 is alone on this level
        MoveStateKlaus[] klauses = GameObject.FindObjectsOfType <MoveStateKlaus>();
        if (klauses == null || klauses.Length == 0)
        {
            UIFontSetter fontSetter = quoteText.GetComponent <UIFontSetter>();
            if (fontSetter != null)
            {
                fontSetter.ChangeFontType(FontsManager.FontType.K1);
            }
        }

        quoteText.ObjectText = quoteText.ObjectText.ToUpper();
    }
Ejemplo n.º 4
0
    public void Setup(Font font, int worldID, int levelID, string codeLevel, string[] sections, Sprite picture, bool hasTimeAttack = false, float timeRecord = 0f, float companyTime = 0f, int currentPieces = 0, int totalPieces = 0)
    {
        this.levelID      = levelID;
        sceneName         = codeLevel;
        sectionNames      = sections;
        screenshot.sprite = picture;

        // Set fonts;
        if (font != null)
        {
            for (int i = 0; i != texts.Length; ++i)
            {
                if (texts[i].font.name != font.name)
                {
                    texts[i].font = font;
                }
            }
        }

        // Time attack
        timeAttackObject.SetActive(hasTimeAttack);
        timeAttackAvailable = hasTimeAttack;
        bestText.text       = timeRecord > 0 ? HUD_TimeAttack.FormatTime(timeRecord) : "--:--:--";
        companyRecord       = companyTime;

        // Collectibles
        memoriesObject.SetActive(totalPieces > 0);
        piecesText.text = currentPieces + "/" + totalPieces;

        string key = "LName" + (worldID + 1).ToString("00") + "." + (levelID + 1).ToString("00");

        if (key == "LName01.07")
        {
            key = "W1Boss.01";
        }
        else if (key == "LName04.07")
        {
            key = "W6LBOSS-28";
        }
        else if (key == "LName06.06")
        {
            key = "W6LBOSS-19";
        }

        levelNameText.UpdateKey(key);
    }
Ejemplo n.º 5
0
    void OnGameLoaded()
    {
        // Get total time played
        timePlayedText.text = HUD_TimeAttack.FormatTime(SaveManager.Instance.dataKlaus.totalTimePlayed);

        // Get story progress
        float storyProgress = SaveManager.Instance.GetHistoryPercent();

        storyText.text = Mathf.FloorToInt(storyProgress) + "%";

        // Get total deaths
        deathsText.text = SaveManager.Instance.dataKlaus.deaths.ToString();

        // Get total memories
        int currentPieces = 0;
        int totalPieces   = 0;

        for (int i = 0; i != SaveManager.Instance.dataKlaus.collectablesItems.Count; ++i)
        {
            totalPieces   += SaveManager.Instance.dataKlaus.collectablesItems[i].item.Count;
            currentPieces += SaveManager.Instance.dataKlaus.collectablesItems[i].item.FindAll(x => x).Count;
        }

        piecesText.text = currentPieces.ToString("00") + "/" + totalPieces.ToString("00");

        // Get memories completed
        int memoriesCompleted = 0;
        int totalMemories     = 6;

        for (int i = 1; i != 7; ++i)
        {
            memoriesCompleted += CollectablesManager.isCollectableFull("W" + i) ? 1 : 0;
        }

        memoriesCompletedText.text = memoriesCompleted.ToString() + "/" + totalMemories.ToString();

        // Get time attack progress
        float timeAttackProgress = 100f * (float)SaveManager.Instance.dataKlaus.GetBrokenCompanyRecords() / (float)SaveManager.Instance.dataKlaus.GetTotalCompanyRecords();

        timeAttackText.text = Mathf.FloorToInt(timeAttackProgress) + "%";

        // Get overall progress
        progressText.text = Mathf.FloorToInt(storyProgress * 0.5f + timeAttackProgress * 0.25f + 25f * (float)currentPieces / (float)totalPieces) + "%";
    }
Ejemplo n.º 6
0
    void Setup()
    {
        _hud      = null;
        _triggers = null;

        foreach (TimeAttackTrigger trigger in triggers)
        {
            trigger.gameObject.SetActive(false);
        }

        if (SaveManager.Instance.dataKlaus != null)//Luis Fix
        {
            bestTime = SaveManager.Instance.dataKlaus.GetTime(Application.loadedLevelName);
        }
        else
        {
            bestTime = 0;
        }

        if (CanEnableTimeAttackMode())
        {
            if (timerRunning)
            {
                audio1.UnPause();
                ShowHud();
                PlayTimer();
            }
            else
            {
                foreach (TimeAttackTrigger trigger in triggers)
                {
                    trigger.gameObject.SetActive(!trigger.isGoal);
                }

                StopTimer();
                audio1.Stop();
            }
        }
        else
        {
            StopTimer(false);
        }
    }