12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- using System.Collections;
- using System.Collections.Generic;
- using System.Data;
- using UnityEngine;
- using UnityEngine.UI;
-
- public class Auto_Alarm : MonoBehaviour
- {
- [SerializeField] GameObject 異常燈號_pic;
- public int[] 電能異常BL_code;
- /*void Update()
- {
- if(Main.Global.系統選擇=="消防系統"){
- if(Main.Global.消防異常清單.Rows.Count > 0 ){
- bool hasException = false; // 設定一個 flag,紀錄是否有設定過有異常為 true
- foreach (DataRow row in Main.Global.消防異常清單.Rows) {
- if (row[3].ToString() == 異常燈號_pic.name) {
- if (!GetComponent<Animator>().GetBool("有異常")) {
- GetComponent<Animator>().SetBool("有異常", true);
- }
- hasException = true; // 將 flag 設為 true,表示已設定過有異常為 true
- }
- }
- if (!hasException) { // 如果沒有符合條件的資料
- GetComponent<Animator>().SetBool("有異常", false); // 將有異常設為 false
- }
- }else{
- GetComponent<Animator>().SetBool("有異常", false);
- }
- }else if(Main.Global.系統選擇=="電能監控系統"){
- foreach (int code in 電能異常BL_code){
- if(Main.Global.電表異常BL[code]==true){
- if (!GetComponent<Animator>().GetBool("有異常")) {
- GetComponent<Animator>().SetBool("有異常", true);
- }
- }else{
- GetComponent<Animator>().SetBool("有異常", false);
- }
- }
- }
-
- }*/
- }
|