void Awake() { DontDestroyOnLoad(this); EventManager.StartListening(GlobalEvents.PlayerDead, OnplayerDeath); EventManager.StartListening(GlobalEvents.BossDead, OnMissionSuccess); EventManager.StartListening(GlobalEvents.PointsEarned, UpdatePlayerPoints); EventManager.StartListening(GlobalEvents.MissionStartRequest, StartMission); playerGameObject = Instantiate(Resources.Load("Player")) as GameObject; playerDeathManager = playerGameObject.GetComponentInChildren <PlayerDeathManager>(); playerGameObject.SetActive(false); playerGameObject.transform.SetParent(transform); gameplayCamera = Instantiate(gameplayCameraPrefab); gameplayCamera.transform.SetParent(transform); //FIXME you know what playerTransform = playerGameObject.transform.GetChild(0).transform; if (!playerTransform) { print("FAIL"); } dialog = UIManager.Instance.Dialog; }
private void DestroyAllManagers() { // define your services here CameraManager = null; RaycastManager = null; EnemyManager = null; AttackManager = null; MovingPlayerManager = null; CursorManager = null; SoundManager = null; PlayerDeathManager = null; }
// Start is called before the first frame update void Start() { Time.timeScale = 1; GameObject gameManager = GameObject.Find("GameManager"); soundManager = gameManager.GetComponent <SoundManager>(); playerDeathManager = GetComponent <PlayerDeathManager>(); rb = this.gameObject.GetComponent <Rigidbody2D>(); color = 0; actualBullet = bulletWhite; speedSlow = speed / 3; for (int i = 0; i <= 4; i++) { shooterTransform[i] = shooters[i].transform; } }
private void StartGameManager() { try { // define your services here RaycastManager = new RaycastManager(); EnemyManager = new EnemyManager(); AttackManager = new AttackManager(); MovingPlayerManager = new MovingPlayerManager("Player"); CursorManager = new CursorManager(); SoundManager = new SoundManager(); PlayerDeathManager = new PlayerDeathManager(); CameraManager = new CameraManager("Main Camera"); SFXManager.SetSfx(); } catch (Exception e) { Debug.LogException(e); } }