예제 #1
0
    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);
    }
예제 #3
0
    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();
        }
    }
예제 #5
0
 public void Init(LevelUI screenTransitionController)
 {
     _levelUI               = screenTransitionController;
     _defaultAngularDrag    = Rigidbody.angularDrag;
     Rigidbody.centerOfMass = Vector2.zero;
     Sword.gameObject.SetActive(true);
 }
예제 #6
0
    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();
    }
예제 #7
0
    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;
                }
            }
        }
    }
예제 #8
0
 private void CheckToNullLastSelected(Selectable turnedOff)
 {
     if (lastSelectedLevel != null && turnedOff == lastSelectedLevel.selectable)
     {
         lastSelectedLevel = null;
     }
 }
예제 #9
0
    private void Awake()
    {
        Instance = Instance == null ? this : Instance;

        player  = FindObjectOfType <Player>();
        am      = FindObjectOfType <AudioManager>();
        levelUI = FindObjectOfType <LevelUI>();
    }
예제 #10
0
파일: Player.cs 프로젝트: Joeriri/Tic
 private void Awake()
 {
     //spawn = FindObjectOfType<PlayerSpawn>();
     tileGrid = FindObjectOfType <Grid>();
     kb       = InputSystem.GetDevice <Keyboard>();
     levelUI  = FindObjectOfType <LevelUI>();
     spriteR  = GetComponentInChildren <SpriteRenderer>();
 }
예제 #11
0
    public void ToggleSelectedLevelIsFavorite()
    {
        LevelUI selectedLevelUI = levelUIs[SelectedLevelIndex];

        selectedLevelUI.ToggleIsFavorite();
        selectedLevelFavoriteIcon.enabled = selectedLevelUI.levelData.isFavorite;
        DataPersister.Instance.TrySaveDataFile();
    }
예제 #12
0
    void Start()
    {
        UI = FindObjectOfType <LevelUI>();

        Acorns = FindObjectsOfType <JumpingGameCollectable>();
        Acorns = Acorns.OrderBy(x => x.transform.position.x).ToArray();

        _collectedAcorns = 0;
    }
예제 #13
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);
        }
예제 #14
0
파일: GameManager.cs 프로젝트: Joeriri/Tic
    private void Awake()
    {
        Instance = this;

        tileGrid    = FindObjectOfType <Grid>();
        levelLoader = FindObjectOfType <LevelLoader>();
        levelUI     = FindObjectOfType <LevelUI>();
        transition  = FindObjectOfType <FadeTransition>();
    }
예제 #15
0
 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;
 }
예제 #16
0
    private void OnCalcLevelProgress(float progress)
    {
        LevelUI.SetLevelProgress(progress);

        if (progress >= 80)
        {
            gameController.LevelComplete();
        }
    }
예제 #17
0
    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();
    }
예제 #18
0
    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>();
    }
예제 #20
0
    private void UpdateTimer()
    {
        levelTimer -= Time.deltaTime;

        if (levelTimer <= 0)
        {
            gameController.GameOver();
        }

        LevelUI.SetTimer(levelTimer);
    }
예제 #21
0
    private void OnEnable()
    {
        levelUI = LevelUI.GetInstance();

        sp = GetComponent <StartingPresent>();

        oneSec = new WaitForSeconds(1);

        levelUI.AnnouncerTextLine.gameObject.SetActive(false);

        StartCoroutine("StartGame");
    }
예제 #22
0
 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");
    }
예제 #24
0
 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
     };
 }
예제 #25
0
 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);
     }
 }
예제 #26
0
    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>();
    }
예제 #27
0
    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");
    }
예제 #28
0
    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());
    }
예제 #31
0
파일: LevelUI.cs 프로젝트: craus/UnityTest
 public override void Awake()
 {
     base.Awake();
     instance = this;
 }