public void GoToNextLevel() { int nextSceneIndex = SceneManager.GetActiveScene().buildIndex + 1; if (SceneManager.sceneCountInBuildSettings > nextSceneIndex) { GoToLevel(nextSceneIndex); } else { // Show game completed menu, if it doesn't exist, go to the main menu LevelUI LevelUI = GameObject.Find("UI Manager").GetComponent <LevelUI>(); GameObject GameCompletedParent = GameObject.Find("GameCompletedParent"); GameObject GameCompletedMenu = GameCompletedParent.transform.GetChild(0).gameObject; if (LevelUI != null && GameCompletedMenu != null) { LevelUI.GetComponent <LevelUI>().isPause = true; GameCompletedMenu.SetActive(true); GameCompletedMenu.GetComponent <Animator>().SetBool("SlideOut", true); } else { GoToLevel(0); } } }
// Start is called before the first frame update void Start() { levelUI = LevelUI.GetInstance(); levelUI.AnnouncerTextLine.gameObject.SetActive(false); levelUI.healthSliders[0].gameObject.SetActive(false); levelUI.healthSliders[1].gameObject.SetActive(false); levelUI.LevelTimer.gameObject.SetActive(false); fade.SetActive(true); bars = GetComponentInChildren <CinematicBars>(); bars.Show(200, 1); anim = GetComponent <Animator>(); //player_1.GetComponent<StateManager>().dontMove = true; //player_2.GetComponent<StateManager>().dontMove = true; DisableFighters(); cam = GetComponentInChildren <Camera>(); lm = GetComponent <LevelManager>(); lm.enabled = false; anim.SetInteger("Location", 1); }
private void GenerateLevelUI() { ResetLevelUIsForHathosLevels(); int i = NumHathosLevels; levelUIPrefab.SetActive(true); Levels.ForEach(level => { if (!string.IsNullOrEmpty(level.name)) { GameObject newUI = Instantiate(levelUIPrefab, levelContentParent); newUI.transform.localScale = Vector3.one; newUI.name = string.Format("{0}{1}", newUI.name, i); LevelUI levelUI = newUI.GetComponent <LevelUI>(); levelUI.Initialize(this, level, i); levelUIs.Add(levelUI); } i++; }); levelUIPrefab.SetActive(false); System.Predicate <LevelUI> containsLevel = level => !string.IsNullOrEmpty(level.levelData.name); if (levelUIs.Count > 0 && levelUIs.Exists(containsLevel)) { int firstIndex = levelUIs.FindIndex(containsLevel); SelectLevel(firstIndex); } OnSearchChange(); }
public void UpdateUI() { button.enabled = !data.locked; lockImage.gameObject.SetActive(data.locked); mainImage.color = data.locked ? lockedColor : unlockedColor; if (nameText) { nameText.text = data.name; } if (completionPercentText) { completionPercentText.text = (( int )(data.completionPercent * 100)).ToString() + " %"; } for (int i = 0; i < levelContainer.childCount; i++) { Destroy(levelContainer.GetChild(i).gameObject); } for (int i = 0; i < data.levels.Length; i++) { LevelUI ui = Instantiate(levelUIPrefab, levelContainer); ui.data = data.levels[i]; ui.UpdateUI(); } }
public void Init(LevelUI screenTransitionController) { _levelUI = screenTransitionController; _defaultAngularDrag = Rigidbody.angularDrag; Rigidbody.centerOfMass = Vector2.zero; Sword.gameObject.SetActive(true); }
public void SelectLevel(int levelIndex, bool selectSelectable = true) { SFXManager.Instance.Play(SFXType.UI_Click); Timing.KillCoroutines(PulseCoroutineName); if (lastSelectedLevel != null) { lastSelectedLevel.ScaleLevelUISize(1f); } SelectedLevelIndex = levelIndex; selectLevelAnim.OnUpdate = SelectedLevelUI.ScaleLevelUISize; selectLevelAnim.Animate(PulseCoroutineName); if (selectSelectable) { SelectedLevelUI.selectable.Select(); CurrentEventSystem.SetSelectedGameObject(SelectedLevelUI.selectable.gameObject); } lastSelectedLevel = SelectedLevelUI; LevelData selectedLevel = SelectedLevelUI.levelData; selectedLevelNameText.text = selectedLevel.name; selectedLevelDescriptionText.text = selectedLevel.description; Sprite spriteToShow = selectedLevel.isHathosLevel ? hathosBigPreview : selectedLevel.MySprite; selectedLevelImage.sprite = spriteToShow; levelUIs.ForEach(levelUI => { levelUI.OnGroupSelectChanged(levelIndex); }); selectedLevelFavoriteIcon.enabled = selectedLevel.isFavorite; SetButtonsInteractabilityAndNavigation(); AlignScrollbar(); }
public virtual void Refresh() { foreach (Transform t in content) { Destroy(t.gameObject); } for (int i = 0; i < PlayerData.starNumberPerLevel.Count; i++) { int playerLevelData = PlayerData.starNumberPerLevel[i]; LevelUI ui = LevelUI.Instantiate(LevelUIPrefab, content); ui.onClicked.AddListener(UIClicked); //Debug.Log('v'); Level level = ui.gameObject.GetComponent <Level>(); level.index = i; level.stars = playerLevelData; ui.Display(level); if (!UnlockAllLevels) { if (level.stars == 0) { break; } } } }
private void CheckToNullLastSelected(Selectable turnedOff) { if (lastSelectedLevel != null && turnedOff == lastSelectedLevel.selectable) { lastSelectedLevel = null; } }
private void Awake() { Instance = Instance == null ? this : Instance; player = FindObjectOfType <Player>(); am = FindObjectOfType <AudioManager>(); levelUI = FindObjectOfType <LevelUI>(); }
private void Awake() { //spawn = FindObjectOfType<PlayerSpawn>(); tileGrid = FindObjectOfType <Grid>(); kb = InputSystem.GetDevice <Keyboard>(); levelUI = FindObjectOfType <LevelUI>(); spriteR = GetComponentInChildren <SpriteRenderer>(); }
public void ToggleSelectedLevelIsFavorite() { LevelUI selectedLevelUI = levelUIs[SelectedLevelIndex]; selectedLevelUI.ToggleIsFavorite(); selectedLevelFavoriteIcon.enabled = selectedLevelUI.levelData.isFavorite; DataPersister.Instance.TrySaveDataFile(); }
void Start() { UI = FindObjectOfType <LevelUI>(); Acorns = FindObjectsOfType <JumpingGameCollectable>(); Acorns = Acorns.OrderBy(x => x.transform.position.x).ToArray(); _collectedAcorns = 0; }
public static LevelUI CreateLevelUI(ContentManager content, GraphicsDevice graphicsDevice, string backgroundPath) { Texture2D backgroundTexture = content.Load <Texture2D>(backgroundPath); Rectangle backgroundTextureBox = new Rectangle(0, 0, graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height); SpriteUI backgroundSprite = new SpriteUI(backgroundTextureBox, backgroundTexture); LevelUI level = new LevelUI(backgroundSprite); return(level); }
private void Awake() { Instance = this; tileGrid = FindObjectOfType <Grid>(); levelLoader = FindObjectOfType <LevelLoader>(); levelUI = FindObjectOfType <LevelUI>(); transition = FindObjectOfType <FadeTransition>(); }
void Awake() { _instance = this; levelListGrid1 = transform.Find("Scroll View/Grid1").GetComponent <UIGrid> (); levelListGrid2 = transform.Find("Scroll View/Grid2").GetComponent <UIGrid> (); levelListGrid3 = transform.Find("Scroll View/Grid3").GetComponent <UIGrid> (); levelListGrid4 = transform.Find("Scroll View/Grid4").GetComponent <UIGrid> (); LevelManager._instance.OnLevelChange += this.OnLevelChange; }
private void OnCalcLevelProgress(float progress) { LevelUI.SetLevelProgress(progress); if (progress >= 80) { gameController.LevelComplete(); } }
private void Start() { timer = GameObject.FindObjectOfType <Timer>(); spawnPos = player.transform.position; screnshake = Camera.main.GetComponent <ScreenShakeTest>(); score = new Score(); levelUI = GameObject.FindGameObjectWithTag("LevelUI").GetComponent <LevelUI>(); levelUI.SelectGamePlayUI(); }
void SetLevelUI(Level level, int index) { TMP_Dropdown subTopic = objectPool.PullSubTopicUI(); LevelUI levUI = objectPool.PullLevelUI(); levUI.SetData(level, subTopic, index); levUI.transform.SetParent(content); subTopic.transform.SetParent(content); subTopic.gameObject.SetActive(false); }
private void Awake() { if (SaveManager.Instance.saveData.levelsUnlocked < stat.unlockAtLevel) { Destroy(this.gameObject); } GetComponentInChildren <Button>().onClick.AddListener(InfoBTNClicked); levelUI = FindObjectOfType <LevelUI>(); }
private void UpdateTimer() { levelTimer -= Time.deltaTime; if (levelTimer <= 0) { gameController.GameOver(); } LevelUI.SetTimer(levelTimer); }
private void OnEnable() { levelUI = LevelUI.GetInstance(); sp = GetComponent <StartingPresent>(); oneSec = new WaitForSeconds(1); levelUI.AnnouncerTextLine.gameObject.SetActive(false); StartCoroutine("StartGame"); }
private void SendScoresToLeaderboard() { if (!SceneTracker.IsCurrentSceneEditor) { LevelUI levelUI = ((PLELevelSelectMenu)MenuManager.Instance.GetMenuByName(Strings.MenuStrings.LevelEditor.LEVELSELECT_PLE_MENU)).SelectedLevelUI; if (levelUI != null) { string levelName = levelUI.levelData.UniqueSteamName; LeaderBoards.Instance.UpdateScore(score, levelName); } } }
void Start() { Playerr = CharacterManager.GetInstance(); levelUI = LevelUI.GetInstance(); shoot = CameraManager.GetInstance(); Secs = new WaitForSeconds(1); levelUI.Line1.gameObject.SetActive(false); levelUI.Line2.gameObject.SetActive(false); StartCoroutine("Start"); }
public override void Start() { levelUI = new LevelUI(); level = Level.LoadFromFile($"Content/Levels/{CurrentLevel}.lvl", out bool success); if (!success) { Manager.SetScene <MainMenuScene>(); } controller = new PlayerController() { Player = level.Player, DeadZone = 0.3f }; }
void Awake() {//Check if instance already exists if (instance == null) { //if not, set instance to this instance = this; } //If instance already exists and it's not this: else if (instance != this) { //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager. Destroy(gameObject); } }
void Start() { attractors = FindObjectsOfType(typeof(Attractor)) as Attractor[]; projectile = LoadSingleObject <Projectile>(); projectileRB = projectile.GetComponent <Rigidbody2D>(); Debug.Assert(projectileRB != null, "Projective should have Rigidbody2D component attached"); gate = LoadSingleObject <Gate>(); gate.parentScene = this; finishLevelDlg = LoadSingleObject <FinishLevelDlg>(); levelUI = LoadSingleObject <LevelUI>(); }
void Start() { //получим объекты из других скриптов charM = CharacterManager.GetInstance(); levelUI = LevelUI.GetInstance(); camM = CameraManager.GetInstance(); //задаем количество секунд переменной oneSec oneSec = new WaitForSeconds(1); levelUI.AnnouncerTextLine1.gameObject.SetActive(false); levelUI.AnnouncerTextLine2.gameObject.SetActive(false); StartCoroutine("StartGame"); }
void Start() { //get the references from the singletons charM = CharacterManager.GetInstance(); levelUI = LevelUI.GetInstance(); camM = CameraManager.GetInstance(); //init the WaitForSeconds oneSec = new WaitForSeconds(1); levelUI.AnnouncerTextLine1.gameObject.SetActive(false); levelUI.AnnouncerTextLine2.gameObject.SetActive(false); StartCoroutine("StartGame"); }
// Use this for initialization void Start() { // referencias del singleton charM = CharacterManager.GetInstace(); levelUI = LevelUI.GetInstance(); // esperas un segundo oneSec = new WaitForSeconds(1); // los anuncios estan cerrados levelUI.AnnouncerTextLine1.gameObject.SetActive(false); levelUI.AnnouncerTextLine2.gameObject.SetActive(false); StartCoroutine("StartGame"); }
void Start() { //grab references charM = CharacterManager.GetInstance(); levelUI = LevelUI.GetInstance(); //initialize the wait. oneSec = new WaitForSeconds(1); levelUI.AnnouncerTextLine1.gameObject.SetActive(false); levelUI.AnnouncerTextLine2.gameObject.SetActive(false); StartCoroutine(StartGame()); }
public override void Awake() { base.Awake(); instance = this; }