Ejemplo n.º 1
0
 void Awake()
 {
     _spriteRenderer = GetComponent<SpriteRenderer>();
     OnLeftTeam = transform.position.x <= 14.5 ? true : false;
     _leftPlayerScript = GameObject.FindGameObjectWithTag("LeftPlayer").GetComponent<BasePlayer>();
     _levelManagerScript = Camera.main.GetComponent<LevelManager>();
 }
Ejemplo n.º 2
0
        private void Awake()
        {
            //Check if Instance already exists
            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(this.gameObject);
                }
            }

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

            this._levelManager = this.GetComponent<LevelManager>();
            this._uiManager = this.GetComponent<UIManager>();

            this.InitGame();
        }
Ejemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     _slider = GameObject.FindObjectOfType<Slider>();
     _slider.maxValue = 1;
     _slider.minValue = 0;
     _levelManager = GameObject.FindObjectOfType<LevelManager>();
     _audioSource = GetComponent<AudioSource>();
     _winLabel = GameObject.Find("WinBanner") as GameObject;
     _winLabel.SetActive(false);
 }
Ejemplo n.º 4
0
 void Start()
 {
     _levelManager = FindObjectOfType<LevelManager>();
 }
Ejemplo n.º 5
0
 void OnTriggerEnter2D(Collider2D collider)
 {
     //Debug.Log("Trigger");
     LevelManager.LoadLoseLevel();
 }