Beispiel #1
0
    void updateStats()
    {
        mapNameText.text = StageInfo.mapName();

        float statsMapLocal   = StageInfo.statsMapLocal(player);
        float statsMapGlobal  = StageInfo.statsMapGlobal(player);
        float statsItemLocal  = StageInfo.statsItemLocal(player);
        float statsItemGlobal = StageInfo.statsItemGlobal(player);

        statsMapL.text  = (statsMapLocal >= 0) ? statsMapLocal + "%" : "- %";
        statsMapG.text  = (statsMapGlobal >= 0) ? statsMapGlobal + "%" : "- %";
        statsItemL.text = (statsItemLocal >= 0) ? statsItemLocal + "%" : "- %";
        statsItemG.text = (statsItemGlobal >= 0) ? statsItemGlobal + "%" : "- %";

        decideTextColor(statsMapL);
        decideTextColor(statsMapG);
        decideTextColor(statsItemL);
        decideTextColor(statsItemG);
    }
Beispiel #2
0
    private void Awake()
    {
        player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>();
        img    = transform.GetChild(1).GetComponent <Image>();

        scoreValues         = transform.GetChild(0).GetChild(0).GetChild(0).gameObject;
        scoreRanks          = transform.GetChild(0).GetChild(0).GetChild(1).gameObject;
        completionTime      = player.gameTimer;
        mapCompletion       = StageInfo.statsMapGlobal(player);
        itemCompletion      = StageInfo.statsItemGlobal(player);
        nOfEnemiesKilled    = player.nOfEnemiesKilled;
        totalDamageReceived = player.totalDamageReceived;

        GameObject[] dontDestroyOnLoadObjects = new GameObject[] { player.gameObject,
                                                                   GameObject.FindGameObjectWithTag("MainCamera"), GameObject.Find("MusicManager") };

        foreach (GameObject g in dontDestroyOnLoadObjects)
        {
            if (g != null)
            {
                Destroy(g);
            }
        }
    }