// Use this for initialization
 void Start()
 {
     enable_control = false;
     g = null;
     pp = null;
     checkForControl();
 }
    void checkForControl()
    {
        pp = GameObject.Find("Mathius").GetComponent("PaulPlayer") as PaulPlayer;
        g = GameObject.Find("Gun").GetComponent("Gun") as Gun;

        if(pp==null || g == null) enable_control = false;
        else enable_control = true;
    }
Пример #3
0
    private void OnSceneLoaded(Scene aScene, LoadSceneMode aMode)
    {
        //all of what you see here is to find the game objects needed for the game to function properly on scene load
        //things like the player and the shop and ability manager are all found here without the need to drag and drop
        #region Gets Reference to AbilityManager
        if (GameObject.FindGameObjectWithTag("AbilityManager") == null)
        {
            Debug.Log("AbilityManager does not exists");
        }
        else
        {
            aManager = GameObject.FindGameObjectWithTag("AbilityManager").GetComponent <AbilityManager>();
            Debug.Log("AbilityManager does exists");
        }
        #endregion

        #region Checks for shop in each loaded scene
        if (GameObject.FindGameObjectWithTag("Shop") == null)
        {
            Debug.Log("Shop does not exists");
            return;
        }
        else
        {
            Debug.Log("Shop was found");
            shop = GameObject.FindGameObjectWithTag("Shop");
            shop.SetActive(false);
        }
        #endregion

        #region Looks for player in loaded scene
        if (GameObject.FindGameObjectWithTag("Player") == null)
        {
            Debug.Log("Player not found in scene");
        }
        else
        {
            player = GameObject.FindGameObjectWithTag("Player").GetComponent <PaulPlayer>();
        }
        #endregion
    }