GameOverUI.cs 851 B

12345678910111213141516171819202122232425262728293031
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class GameOverUI : MonoBehaviour
  5. {
  6. public GameObject[] ScoreObj;
  7. public GameObject[] ShotObj;
  8. public GameObject[] HitObj;
  9. public GameObject[] HitRateObj;
  10. // Start is called before the first frame update
  11. void Start()
  12. {
  13. bool isChinese = TextAutoLanguage2.GetLanguage() == LanguageEnum.Chinese;
  14. SetLanguageObjects(ScoreObj, isChinese);
  15. SetLanguageObjects(ShotObj, isChinese);
  16. SetLanguageObjects(HitObj, isChinese);
  17. SetLanguageObjects(HitRateObj, isChinese);
  18. }
  19. private void SetLanguageObjects(GameObject[] objects, bool isChinese)
  20. {
  21. if (objects == null || objects.Length < 2) return;
  22. objects[0].SetActive(isChinese);
  23. objects[1].SetActive(!isChinese);
  24. }
  25. }