public void Reset() { var scoreBG = GameObject.Find("scoreBG"); if (scoreBG != null) { scoreBG.GetComponent <Renderer>().enabled = false; } SetGO(false); var balls = GameObject.FindGameObjectsWithTag("Ball"); foreach (var ball in balls) { Destroy(ball); } level = MapMakker.GetMap(GameMaster.levelName); IsWinningCheckAlreadyHappened = false; finishedIpis = 0; var resetebelList = FindAllByInterface <IReset>();; foreach (var gunsObject in resetebelList) { IReset resetebelGameObject = gunsObject as IReset; resetebelGameObject.Reset(); } IpiCounter.Reset(); }
void Start() { GatesPosition = new List <Vector3>(); finishedIpis = 0; Screen.orientation = ScreenOrientation.LandscapeLeft; SetGO(false); Screen.sleepTimeout = (int)SleepTimeout.NeverSleep; //Tundub,et unity kiiks, et seda tuleb ise alati settida SetDeviceRotationOptions(); IpiCounter.Reset(); animatingTileCount = 0; levelProgressWrapper = LevelProgressHelper.GetLevelProgress(); }
private void Start() { Level level = MapMakker.GetMap(GameMaster.levelName); List <Info> list = level.elements; foreach (Info item in list) { var res = Resources.Load("Prefabs/tiles/" + item.prefabName) as GameObject; if (res == null) { continue; } Instantiate(res, item.GetPosition(level.StartXPosition, level.StartYPosition, res.transform.position.z), Quaternion.identity); } ScoreBoard scoreBoard = GameMaster.GetScoreBoard(); MainMenu mainMenu = GameMaster.GetMainMenu(); mainMenu.level = level; for (int index = 0; index < level.Inventory.Count; index++) { InventoryInfo item = level.Inventory[index]; // add to scorebaord scoreBoard.List.Add(new GateLimitWorkSet { number = item.count, name = item.prefabName }); var res = Resources.Load("Prefabs/inventory/" + item.prefabName) as GameObject; if (res == null) { Debug.Log("Resources.Load(Prefabs/inventory/" + item.prefabName + ") is null"); continue; } var v3 = new Vector3(-4.8f + (index * 2.3f), -5.5f, 0); Instantiate(res, v3, Quaternion.identity); var background = Resources.Load("Prefabs/InventoryBackground") as GameObject; if (background == null) { continue; } var vback = new Vector3(v3.x, -5.5f, 0.2f); Instantiate( background, vback, Quaternion.identity); } GameObject popup = null; if (!string.IsNullOrEmpty(level.OnStartPopUp)) { popup = Resources.Load("Prefabs/tutorial/" + level.OnStartPopUp) as GameObject; if (popup == null) { Debug.Log("Resources.Load(Prefabs/inventory/" + level.OnStartPopUp + ") is null"); } else { Instantiate(popup); } } scoreBoard.Clear(); GameMaster.AdjustGUISizes(); IpiCounter.Reset(); ScoreBoard.UpdateLabel(); }
void Update() { if (IpiCounter.Any()) { return; } //Selleks, et surma animatsioon mängitaks lõpuni viimastel ipidel var ipis = GameObject.FindGameObjectsWithTag("Ball"); if (ipis != null && ipis.Length > 0) { return; } if (IsWinning() && !IsWinningCheckAlreadyHappened) { var starCount = GetCurrentSessionStarCount(); MarkLevelCompleted(); UnLockNextLevel(); IsWinningCheckAlreadyHappened = true; var startBtn = GameObject.Find("startBtn"); if (startBtn != null) { var startOnClick = startBtn.GetComponent <StartOnClick>(); if (startOnClick != null) { startOnClick.ResetStartTexture(); } } GameMaster.HideGateLables(true); GameObject scoreBG = GameObject.Find("scoreBG"); if (scoreBG != null) { if (scoreBG.GetComponent <Renderer>() != null) { scoreBG.GetComponent <Renderer>().enabled = true; } } if (WinScreen != null) { var winScreen = Instantiate(WinScreen, WinScreen.transform.position, Quaternion.identity) as GameObject; AudioSource.PlayClipAtPoint(winConditionAudio, transform.position); foreach (Transform child in winScreen.transform) { if (child.name == "star1" && starCount < 1) { DestoryActivStar(child); } else if (child.name == "star2" && starCount < 2) { DestoryActivStar(child); } else if (child.name == "star3" && starCount < 3) { DestoryActivStar(child); } } } } else if (go && !IsWinningCheckAlreadyHappened) { MainMenu.UpdateCurrentLevelIpisMaxCount(); isLoosing = true; } }
public static void StartGame() { SetGO(true); IpiCounter.Reset(); }