コード例 #1
0
 // Update is called once per frame
 void Update()
 {
     if (WheelchairMovementScript.MovedFowards == true)
     {
         MenuGameMenuStateScript.MenuStateChange(3);
     }
 }
コード例 #2
0
 void OnCollisionEnter2D(Collision2D coll)
 {
     if (coll.collider.tag == "Enemy")
     //if (collider.tag == "Boss){ lose more health--;} and so-on
     {
         //Function can be changed to remove health decrementally or provide insta kill
         PlayerHealth -= 0.1f;
     }
     if (PlayerHealth == 0)
     {
         //Game Over...
         MenuGameMenuStateScript.MenuStateChange(2);
     }
 }
コード例 #3
0
    void CreateName()
    {
        Name = AlphabetArray [Acounter] + AlphabetArray [Bcounter] + AlphabetArray [Ccounter];

        //load in the CSV file for the leaderboard
        ReadFile.Load("Assets/Data Files/TestLeaderboard.txt");

        int score    = 500;                     // will be changed ot the attual score
        int TimeRank = 0;                       // used when looping to find the players rank

        for (int x = 0; x < ReadFile.CompletionTimeData.Count; x++)
        {
            if (ReadFile.CompletionTimeData [x].Data > score)
            {
                TimeRank = x;
            }
        }
        ReadFile.CompletionTimeData.Insert(TimeRank, new ReadFile.LeaderboardData(Name, score));


        int EnemiesRank = 0;                        // used when looping to find the players rank

        for (int x = 0; x < ReadFile.EnemiesKilledData.Count; x++)
        {
            if (ReadFile.EnemiesKilledData [x].Data > score)
            {
                EnemiesRank = x;
            }
        }
        ReadFile.EnemiesKilledData.Insert(EnemiesRank, new ReadFile.LeaderboardData(Name, score));

        int DamageRank = 0;                        // used when looping to find the players rank

        for (int x = 0; x < ReadFile.LeastDamageData.Count; x++)
        {
            if (ReadFile.LeastDamageData [x].Data > score)
            {
                DamageRank = x;
            }
        }
        ReadFile.LeastDamageData.Insert(DamageRank, new ReadFile.LeaderboardData(Name, score));
        SaveFile.SaveCSV("Assets/Data Files/Leaderboard.txt"); // added purely to test the save file
        MenuGameMenuStateScript.MenuStateChange(4);            // change to leaderboard
    }