Beispiel #1
0
    // Start is called before the first frame update
    void Awake()
    {
        player           = GetComponent <Player>();
        ennemies         = new List <Ennemi>();
        cartecontrolleur = GetComponent <CarteControlleur>();
        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);
        }

        //Sets this to not be destroyed when reloading scene
        DontDestroyOnLoad(gameObject);

        //Get a component reference to the attached BoardManager script
        cartecontrolleur = GetComponent <CarteControlleur>();

        //Call the InitGame function to initialize the first level
        InitGame();
    }
 void Start()
 {
     camTop = GameObject.Find("CameraTop");
     camFP = transform.Find("tete").gameObject.transform.Find("CameraFP").gameObject;
     camOblique = transform.Find("tete").gameObject.transform.Find("CameraOblique").gameObject;
     maxJauge=1;
     nbChangementsDispo=1;
     scriptMouvement = gameObject.transform.Find("tete").GetComponent<mouvement>();
     //scriptMouvement = gameObject.GetComponent<mouvement>();
     controleur = ControlleurJeu.instance;
     jauge =transform.Find("tete").gameObject.transform.Find("jaugeMouvementsDispos").gameObject;
     rendererJauge = jauge.GetComponent<Renderer>();
 }