Beispiel #1
0
        /// <summary>
        ///
        /// Initialise l'HUD avec les events, le score, etc
        ///
        /// </summary>
        override protected void Start()
        {
            if (instance == null)
            {
                instance = this;
            }
            else
            {
                Destroy(gameObject);
            }

            //LevelManager.UpdateScore += LevelManager_UpdateScore;
            PlayerPhysics.OnUpdateLife         += PlayerPhysics_OnUpdateLife;
            CollectibleManager.UpdateArtefacts += CollectibleManager_UpdateArtefacts;

            foreach (Image art in Artefacts)
            {
                art.gameObject.SetActive(false);
            }

            foreach (GameObject obj in mobileControlsInput)
            {
                obj.SetActive(true);
            }

#if !UNITY_ANDROID && !UNITY_IOS
            foreach (GameObject obj in mobileControlsInput)
            {
                obj.SetActive(false);
            }
#endif

            score              = 0;
            toScores           = new List <float>();
            currentUpdate      = null;
            ScoreText.text     = score.ToString();
            previousFontSize   = ScoreText.fontSize;
            ScoreText.fontSize = previousFontSize;
            notInAnim          = false;

            PauseButton.onClick.AddListener(OnPauseButton);

            FrameToChange.sprite = LevelManager.CurrentLevelIndex == 1 ? Level1Frame : Level2Frame;

            base.Start();

            LifeUI = Instantiate(lifePrefab, transform.parent);
            LifeUI.transform.localScale = Vector3.one * 2;
            LifeUI.GetComponent <UILife>().Init(0, 100);

            LevelManager_UpdateScore();

            FinalPos = Artefacts[0].transform.position;
        }
Beispiel #2
0
        /// <summary>
        ///
        ///
        ///
        /// </summary>
        private void OnDestroy()
        {
            instance.currentUpdate = null;
            if (instance == this)
            {
                instance = null;
            }

            StopAllCoroutines();
            toScores = new List <float>();
            //LevelManager.UpdateScore -= LevelManager_UpdateScore;
            PlayerPhysics.OnUpdateLife         -= PlayerPhysics_OnUpdateLife;
            CollectibleManager.UpdateArtefacts -= CollectibleManager_UpdateArtefacts;
        }