public static void Destroy() { //eventManager = null; //taskManager = null; pathFindingManager = null; tileMarkerManager = null; levelEventsController = null; mainController = null; inputController = null; cameraController = null; hudController = null; soundController = null; sceneController = null; sceneTransitionController = null; utils = null; gameEvents = null; comicEvents = null; dotweenEvents = null; men = null; menParentObj = null; }
public static void Init() { eventManager = new Crowd.EventManager(); if (taskManager == null) { taskManager = new Crowd.TaskManager(); } if (GameObject.Find("PathFinder")) { pathFindingManager = GameObject.Find("PathFinder").GetComponent<PathFindingManager>(); } else { pathFindingManager = null; } if (GameObject.Find("LevelEvents")) { levelEventsController = GameObject.Find("LevelEvents").GetComponent<LevelEventsControl>(); } else { levelEventsController = null; } if (GameObject.FindGameObjectWithTag("GameController")) { mainController = GameObject.FindGameObjectWithTag("GameController").GetComponent<MainControl>(); inputController = mainController.gameObject.GetComponent<InputControl>(); sceneController = mainController.gameObject.GetComponent<SceneControl>(); gameEvents = mainController.gameObject.GetComponent<GameEvents>(); dotweenEvents = mainController.gameObject.GetComponent<DotweenEvents>(); if (inputController != null && inputController.groundEnabled) { tileMarkerManager = new TileMarkerManager(); tileMarkerManager.Init(); } else { tileMarkerManager = null; } } else { mainController = null; inputController = null; sceneController = null; gameEvents = null; dotweenEvents = null; } if (GameObject.FindGameObjectWithTag("Transition")) { sceneTransitionController = GameObject.FindGameObjectWithTag("Transition").GetComponent<SceneTransitionControl>(); } else { sceneTransitionController = null; } //if (GameObject.FindGameObjectWithTag("Comic")) //{ // comicEvents = GameObject.FindGameObjectWithTag("Comic").GetComponent<ComicEvents>(); //} //else { comicEvents = null; } if (soundController == null) { soundController = new SoundControl(); soundController.Init(); } if (fmodController == null) { fmodController = new FmodControl(); fmodController.Init(); } if (GameObject.Find("CameraSystem")) { cameraController = GameObject.Find("CameraSystem").GetComponent<CameraControl>(); } else { cameraController = null; } //if (GameObject.FindGameObjectWithTag("SoundSystem")) //{ // soundController = GameObject.FindGameObjectWithTag("SoundSystem").GetComponent<SoundControl>(); // fmodController = GameObject.FindGameObjectWithTag("SoundSystem").GetComponent<FmodControl>(); //} //else //{ // soundController = null; // fmodController = null; //} if (GameObject.Find("Canvas")) { hudController = GameObject.Find("Canvas").GetComponent<HUDControl>(); } else { hudController = null; } utils = new Utils(); men = new List<GameObject>(GameObject.FindGameObjectsWithTag("Man")); menParentObj = GameObject.Find("Actors"); navMeshMinBound = new Vector3(float.MaxValue, float.MaxValue); navMeshMaxBound = new Vector3(-float.MaxValue, -float.MaxValue); GameObject[] navs = GameObject.FindGameObjectsWithTag("Ground"); foreach (GameObject nav in navs) { Collider collider = nav.GetComponent<BoxCollider>(); if (collider != null) { Vector3 c_min = collider.bounds.min; Vector3 c_max = collider.bounds.max; navMeshMinBound = new Vector2( Mathf.Min(c_min.x, navMeshMinBound.x), Mathf.Min(c_min.y, navMeshMinBound.y) ); navMeshMaxBound = new Vector2( Mathf.Max(c_max.x, navMeshMaxBound.x), Mathf.Max(c_max.y, navMeshMaxBound.y) ); } } }