예제 #1
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject[] tempArray = GameObject.FindGameObjectsWithTag("ComputerComponent");


        // Create alert window for every object with tag of ComputerComponent
        for (int i = 0; i < tempArray.Length; i++)
        {
            Machine curMachine = tempArray[i].GetComponent <Machine>();
            componentList.Add(curMachine);
            for (int j = 0; j < curMachine.GetComponentCount(); j++)
            {
                GameObject temp = Instantiate(alertPanelPrefab);
                temp.transform.SetParent(this.transform, false);

                AlertTile tile = temp.GetComponent <AlertTile>();
                // Give each machine its tile so that it has reference to it
                curMachine.AddTile(tile);

                // Add tile to alertTiles list
                alertTiles.Add(tile);

                // Hide new alert
                temp.SetActive(false);
            }
        }
    }
예제 #2
0
 static int SortAlerts(AlertTile alert1, AlertTile alert2)
 {
     return(alert1.health.CompareTo(alert2.health));
 }
예제 #3
0
 public void AddTile(AlertTile tile)
 {
     alertTiles.Add(tile);
 }