// Start is called before the first frame update
    void Start()
    {
        foreach (GameObject obj in GameObject.FindGameObjectsWithTag("Player"))
        {
            players.Add(obj.gameObject);
        }

        foreach (GameObject obj in GameObject.FindGameObjectsWithTag("Enemy"))
        {
            enemies.Add(obj.gameObject);
        }

        blueTeamBtn.onClick.AddListener(BlueTeamReset);
        redTeamBtn.onClick.AddListener(RedTeamReset);
        //Always start from Blue Team
        redTeamBtn.gameObject.SetActive(false);
        redCDPanel.gameObject.SetActive(false);
        blueCDPanel.gameObject.SetActive(false);


        if (PlayerPrefs.GetInt("Mode", 0) != 4)
        {
            dragSystem = FindObjectOfType <DragSystemOffline>().GetComponent <DragSystemOffline>();
            turnMenu   = FindObjectOfType <TurnMenuOffline>().GetComponent <TurnMenuOffline>();
        }
    }
 // Start is called before the first frame update
 void Start()
 {
     try
     {
         turnMenu   = FindObjectOfType <TurnMenuOffline>().GetComponent <TurnMenuOffline>();
         dragSystem = FindObjectOfType <DragSystemOffline>().GetComponent <DragSystemOffline>();
         ballSpeed  = FindObjectOfType <SoccerSpeedControlOffline>().GetComponent <SoccerSpeedControlOffline>();
     }
     catch (Exception e)
     {
         //Avoid crash
     }
 }
Esempio n. 3
0
 private void Update()
 {
     if (turnMenu == null)
     {
         try
         {
             turnMenu = FindObjectOfType <TurnMenuOffline>().GetComponent <TurnMenuOffline>();
         }
         catch (Exception ex)
         {
             //Debug.
         }
     }
 }