// initial setup void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } // all the following will be moved into an "OnSceneLoad" function Physics.IgnoreLayerCollision(11, 11); Physics.IgnoreLayerCollision(10, 11); Physics.IgnoreLayerCollision(8, 11); if (!_ghostObserver) { _ghostObserver = GetComponent <GhostObserver>(); } _playerObject = GameObject.FindGameObjectWithTag("Player"); _playerController = _playerObject.GetComponent <PlayerController>(); _playerController.enabled = false; _spawnLocation = _playerObject.transform.position; paused = true; GameObject[] pellets = GameObject.FindGameObjectsWithTag("Pellet"); _pelletsRemaining += pellets.Length; GameObject[] powerPellets = GameObject.FindGameObjectsWithTag("PowerPellet"); _pelletsRemaining += powerPellets.Length; _pelletsRemaining++; _scoreTxt.text = string.Format("Score: {0}", score.ToString()); _livesTxt.text = string.Format("Lives: {0}", _lives.ToString()); _readyTxt.text = READY_MSG; StartCoroutine(StartPlayer()); }
public void AttachObserver(GhostObserver temp) { Observers.Add(temp.GetID(), temp); }