コード例 #1
0
    public void CompleteLevel()
    {
        //set new PBs
        LevelStats pb;
        LevelStats comparer = new LevelStats();

        //set the global PB to be the new PB if better
        pb = GlobalManager.Instance.LevelCompletionStats[LevelNumber]["PB"];
        pb = LevelStats.GetLowest(pb, currentStats, ref comparer);

        //play animation for improved pb categories
        if (comparer.Time > 0)
        {
        }
        if (comparer.BlocksCollected.Collected > 0)
        {
        }
        if (comparer.BlocksUsed > 0)
        {
        }

        //check the rankings of the new PB
        LevelRanking pbRanking = pb.GetLevelRanking(GlobalManager.Instance.LevelCompletionStats[LevelNumber]);

        //display animations for rankings

        //Save Game
        GlobalManager.Instance.SaveGame();
    }
コード例 #2
0
    public void GetRankings(LevelStats l1, Dictionary <string, LevelStats> dic)
    {
        LevelRanking pbRanking = l1.GetLevelRanking(dic);

        Debug.Log(l1);
        Debug.Log(string.Format("Time: {0}, Blocks Used: {1}, Blocks Collected: {2}", pbRanking.CompletionTime, pbRanking.BlocksUsed, pbRanking.BlocksCollected));
    }
コード例 #3
0
ファイル: LevelStats.cs プロジェクト: pmartin36/Block-Climb
    public LevelRanking GetLevelRanking(Dictionary <string, LevelStats> rankings)
    {
        LevelRanking lr = new LevelRanking();

        LevelStats captain       = rankings["Captain"];
        LevelStats firstmate     = rankings["FirstMate"];
        LevelStats quartermaster = rankings["Quartermaster"];

        //check ranking for completion time
        if (this.Time <= captain.Time)
        {
            lr.CompletionTime = Rank.Captain;
        }
        else if (this.Time < firstmate.Time)
        {
            lr.CompletionTime = Rank.FirstMate;
        }
        else if (this.Time < quartermaster.Time)
        {
            lr.CompletionTime = Rank.Quartermaster;
        }

        //check ranking for blocked used
        if (this.BlocksUsed <= captain.BlocksUsed)
        {
            lr.BlocksUsed = Rank.Captain;
        }
        else if (this.BlocksUsed < firstmate.BlocksUsed)
        {
            lr.BlocksUsed = Rank.FirstMate;
        }
        else if (this.BlocksUsed < quartermaster.BlocksUsed)
        {
            lr.BlocksUsed = Rank.Quartermaster;
        }

        //check ranking for blocked collected
        if (this.BlocksCollected.Collected >= captain.BlocksCollected.Collected)
        {
            lr.BlocksCollected = Rank.Captain;
        }
        else if (this.BlocksCollected.Collected > firstmate.BlocksCollected.Collected)
        {
            lr.BlocksCollected = Rank.FirstMate;
        }
        else if (this.BlocksCollected.Collected > quartermaster.BlocksCollected.Collected)
        {
            lr.BlocksCollected = Rank.Quartermaster;
        }

        return(lr);
    }