public void OnButtonLoad() { myLevel = CS_AnyLevelSave.LoadFile(GetFileName()); if (myLevel != null) { LoadLevelToScene(); } }
public string OnButtonLoad() { myLevel = CS_AnyLevelSave.LoadFile(GetFileName()); if (myLevel != null) { LoadLevelToScene(); } return(myFileName); }
// Use this for initialization void Start() { //create buttons for (int i = 0; i < 5; i++) { CreateButton(CS_Prop_Button.ButtonType.Continue, false); CreateButton(CS_Prop_Button.ButtonType.Quit, false); } //load map myMap = CS_AnyLevelSave.LoadFile(maps [Random.Range(0, maps.Length)]); // myMap = CS_AnyLevelSave.LoadFile (myMapName); if (myMap != null) { foreach (CS_AnyLevelSave_Object f_SaveObject in myMap.anyObjects) { GameObject t_prefab = CS_EverythingManager.Instance.GetAnyLevelPrefab(f_SaveObject.prefabName); GameObject t_GameObject = Instantiate(t_prefab, this.transform); CS_AnyLevelObject t_anyLevelObject = t_GameObject.GetComponent <CS_AnyLevelObject> (); //set name t_GameObject.name = f_SaveObject.name; //set transform t_GameObject.transform.position = (Vector3)(f_SaveObject.position); t_GameObject.transform.localScale = (Vector3)(f_SaveObject.scale); t_GameObject.transform.rotation = (Quaternion)(f_SaveObject.rotation); //set invisible if (t_anyLevelObject.GetMyCategory() == AnyBall.Editor.Category.Invisible) { ((CS_AnyLevelObject_Invisible)t_anyLevelObject).Hide(); } CS_Prop_SpawnArea t_spawnArea = t_GameObject.GetComponent <CS_Prop_SpawnArea> (); if (t_spawnArea != null) { if (t_spawnArea.MySpawnType == CS_Prop_SpawnArea.Type.Player) { mySpawnAreaList_Player.Add(t_spawnArea); } else { mySpawnAreaList_Object.Add(t_spawnArea); } } //remove the any level component Destroy(t_anyLevelObject); } } // //create score board // for (int i = 0; i < Constants.NUMBER_MAX_TEAM; i++) { // CS_ScoreBoard t_scoreBoard = Instantiate (myScoreBoardPrefab).GetComponent<CS_ScoreBoard> (); // myScoreBoards.Add (t_scoreBoard); // // Vector3 t_position = // GetRandomSpawnArea ().GetRandomPoint (); // // t_scoreBoard.Init (i, CS_PlayerManager.Instance.GetTeamColor (i), t_position); // } // // //show and hide score board // for (int i = 0; i < myScoreBoards.Count; i++) { // if (CS_PlayerManager.Instance.IsTeamExist (i)) { // myScoreBoards [i].gameObject.SetActive (true); // } else { // myScoreBoards [i].gameObject.SetActive (false); // } // } //init game score myGameScore.Clear(); for (int i = 0; i < CS_PlayerManager.Instance.GetTeamCount(); i++) { myGameScore.Add(0); } //init player position CS_PlayerManager.Instance.HidePlayerNotInUse(); List <GameObject> t_players = CS_PlayerManager.Instance.MyPlayersInUse; for (int i = 0; i < t_players.Count; i++) { t_players [i].transform.position = GetRandomSpawnArea(CS_Prop_SpawnArea.Type.Player).GetRandomPoint(); } CS_GameScoreBoard.Instance.InitScoreBoard(CS_PlayerManager.Instance.GetTeamCount(), myWinningScore); CS_GameScoreBoard.Instance.Hide(); RoundStart(); }