public void Initialize(bool re_init) { if (initedBefore == false || re_init == true) { //this.checkPointList = FindObjectsOfType<CheckPoint>().ToList();//find and insert all gameobject with checkpoint script this.filemanager = FileManager.Instance; this.achievementmanager = AchievementManager.Instance; this.playercursor = FindObjectOfType <HideCursorScript>(); this.pauseMenu = FindObjectOfType <PauseMenu>(); this.checkPointList.Clear(); this.currentCheckPointIndex = -1; if (ApplicationLevelBoard.Instance.CheckValidGameLevelName(Application.loadedLevelName) == true) { List <CheckPoint> tempCheckPointList = new List <CheckPoint>(); tempCheckPointList = FindObjectsOfType <CheckPoint>().OrderBy(go => go.orderPlacement).ToList(); for (int index = 0; index < tempCheckPointList.Count; ++index) { tempCheckPointList[index].indexInList = index; this.checkPointList.Add(tempCheckPointList[index]); } this.playerobj = GameObject.FindGameObjectWithTag("Player"); this.playerinfo = playerobj.GetComponent <PlayerInfo>(); this.playerinventory = playerobj.GetComponent <Inventory>(); this.playercastslot = playerobj.GetComponent <CastSlot>(); this.playerdialoginferface = DialogInterface.Instance; } this.playerdataPath = filemanager.GetGameDataPath() + "/" + filemanager.backupFolderName + "/" + "backup_" + playerSaveFileName + ".xml"; this.predefinedInventoryPath = filemanager.GetGameDataPath() + "/" + predefinedInventorySaveFileName + ".xml"; initedBefore = true; } }
public void Initialize(bool re_init) { if (initedBefore == false || re_init == true) { inputField = new Rect(0.0f, Screen.height * 0.5f, Screen.width * 0.1f, 20.0f); notificationDisplayRect = new Rect(0.0f, inputField.y + inputField.height, inputField.width, inputField.height); notificationlabelStyle = new GUIStyle(); notificationlabelStyle.normal.textColor = Color.red; notificationlabelStyle.normal.background = Texture2D.blackTexture; //notificationlabelStyle.alignment = TextAnchor.; fallScript = GameObject.FindObjectOfType <FallResponse>(); if (fallScript == null) { Debug.Log("ERROR: DebugControl has null fallScript"); } movementScript = GameObject.FindObjectOfType <FpsMovement>(); if (movementScript == null) { Debug.Log("ERROR: DebugControl has null movementScript"); } levelmanagerScript = GameObject.FindObjectOfType <LevelManager>(); if (levelmanagerScript == null) { Debug.Log("ERROR: DebugControl has null levelmanagerScript"); } inventoryScript = GameObject.FindObjectOfType <Inventory>(); if (inventoryScript == null) { Debug.Log("ERROR: DebugControl has null inventoryScript"); } cursorScript = GameObject.FindObjectOfType <HideCursorScript>(); if (cursorScript == null) { Debug.Log("ERROR: DebugControl has null cursorScript"); } playerobj = GameObject.FindGameObjectWithTag("Player"); if (playerobj == null) { Debug.Log("ERROR: DebugControl has null playerobj"); } initedBefore = true; } }