コード例 #1
0
 //Called from the EnemyHealth script when an enemy is defeated
 public void AddScore(int points)
 {
     //Add points to the player's score
     score += points;
     //If the info text UI element exists, update it to say the player's score
     if (infoText != null)
     {
         infoText.text = "Score: " + score;
     }
     //If the ally manager exists, give it some points for the player to spend on an ally
     if (allyManager != null)
     {
         allyManager.AddPoints(points);
     }
 }
コード例 #2
0
 //当敌人被击败时从EnemyHealth脚本中调用
 //Called from the EnemyHealth script when an enemy is defeated
 public void AddScore(int points)
 {
     //为玩家的分数加分
     //Add points to the player's score
     score += points;
     //如果信息文本UI元素存在,请更新它以表示玩家的得分
     //If the info text UI element exists, update it to say the player's score
     if (infoText != null)
     {
         infoText.text = "Score: " + score;
     }
     //如果盟友管理器存在,请给玩家一些积分以供玩家花在盟友身上
     //If the ally manager exists, give it some points for the player to spend on an ally
     if (allyManager != null)
     {
         allyManager.AddPoints(points);
     }
 }