Beispiel #1
0
    //-------------------------------------------------------------------
    // Metodos
    //-------------------------------------------------------------------

    // Use this for initialization
    void Start()
    {
        forestInstance = EvilForest.instance;
        if (pairEntrance.gameObject.name == "Salidas")
        {
            pairEntrance.SetActive(false);
        }
    }
    //-------------------------------------------------------------------
    // Metodos
    //-------------------------------------------------------------------

    private void Awake()
    {
        if (instance == null)
        {
            //if not, set instance to this
            instance = this;
        }

        //If instance already exists and it's not this:
        else if (instance != this)
        {
            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy(gameObject);
        }
    }