Inheritance: MonoBehaviour
Exemplo n.º 1
0
    public void nextLeveL()
    {
        if (subLevelSecondary < 3)
        {
            subLevelSecondary++;
        }
        else
        {
            subLevelSecondary = 1;
            mainLevel++;
            subLevelMain = mainLevel;
        }

        SubLevelSecondary.GetComponent <TextMeshProUGUI>().text = subLevelSecondary.ToString();
        SubLevelMain.GetComponent <TextMeshProUGUI>().text      = subLevelMain.ToString();
        MainLevel.GetComponent <TextMeshProUGUI>().text         = mainLevel.ToString();

        if (mainLevel == 5 && subLevelSecondary == 3)
        {
            NextLevelButton.GetComponent <Button>().interactable = false;
            LevelSelectionESystem.GetComponent <UnityEngine.EventSystems.EventSystem>().SetSelectedGameObject(PreviousLevelButton);
        }
        else
        {
            NextLevelButton.GetComponent <Button>().interactable = true;
        }

        PreviousLevelButton.GetComponent <Button>().interactable = true;
    }
Exemplo n.º 2
0
    public void previousLevel()
    {
        //for changing levels
        if (subLevelSecondary > 1)
        {
            subLevelSecondary--;
        }
        else
        {
            subLevelSecondary = 3;
            mainLevel--;
            subLevelMain = mainLevel;
        }

        SubLevelSecondary.GetComponent <TextMeshProUGUI>().text = subLevelSecondary.ToString();
        SubLevelMain.GetComponent <TextMeshProUGUI>().text      = subLevelMain.ToString();
        MainLevel.GetComponent <TextMeshProUGUI>().text         = mainLevel.ToString();

        //for restricting level
        if (mainLevel == 1 && subLevelSecondary == 1)
        {
            PreviousLevelButton.GetComponent <Button>().interactable = false;
            LevelSelectionESystem.GetComponent <UnityEngine.EventSystems.EventSystem>().SetSelectedGameObject(NextLevelButton);
        }
        else
        {
            PreviousLevelButton.GetComponent <Button>().interactable = true;
        }

        NextLevelButton.GetComponent <Button>().interactable = true;
    }
Exemplo n.º 3
0
    public void ShowPanel(LevelEndCondition endCondition)
    {
        LevelSceneManager.GameIsActive = false;

        int maxLevel = LevelEditorDataManager.Instance.GetLevelsDictionary().Last().Key;

        switch (endCondition)
        {
        case LevelEndCondition.LevelComplete:
            LevelEndPanelText.key = CompleteKey;
            if (currentLevel != maxLevel)
            {
                NextLevelButton.SetActive(true);
            }
            sfxManager.PlayClip(sfxManager.LevelComplete);
            break;

        case LevelEndCondition.LevelFailed:
            LevelEndPanelText.key = FailKey;
            RetryButton.SetActive(true);
            sfxManager.PlayClip(sfxManager.LevelFailed);
            break;
        }
        LevelEndPanel.SetActive(true);
    }
Exemplo n.º 4
0
 protected override void Awake()
 {
     ClearingTimeText   = CreateGameObject.CreateChildGameObject <ControlText>(transform).GetComponent <ControlText>();
     VictoryText        = CreateGameObject.CreateChildGameObject <ControlText>(transform).GetComponent <ControlText>();
     NextLevelButton    = CreateGameObject.CreateChildGameObject <NextLevelButton>(transform).GetComponent <NextLevelButton>();
     RestartLevelButton = CreateGameObject.CreateChildGameObject <RestartLevelButton>(transform).GetComponent <RestartLevelButton>();
     MainMenuButton     = CreateGameObject.CreateChildGameObject <MainMenuButton>(transform).GetComponent <MainMenuButton>();
     base.Awake();
 }
Exemplo n.º 5
0
    // Update is called once per frame
    void Update()
    {
        float seconds = 4;

        while (seconds > 0)
        {
            seconds -= Time.deltaTime;
        }
        NextLevelButton next = new NextLevelButton();

        next.nextLevel(1);
    }
Exemplo n.º 6
0
    void Awake()
    {
        this.levelController = FindObjectOfType <LevelController>();
        this.nextLevelButton = FindObjectOfType <NextLevelButton>();
        this.nextLevelButton.gameObject.SetActive(false);
        this.restartLevelButton = FindObjectOfType <RestartLevelButton>();
        this.restartLevelButton.gameObject.SetActive(false);

        try
        {
            this.completionMessage        = GameObject.FindGameObjectWithTag("CompletionMessage").GetComponent <Text>();
            this.completionMessagePresent = true;
        }
        catch (System.Exception ex)
        {
            Debug.Log("no completion message, and that is fine");
            Debug.Log(ex.ToString());
        }

        try
        {
            this.scrollInstructions        = FindObjectOfType <ScrollInstructions>().GetComponent <Text>();
            this.scrollInstructionsPresent = true;
        }
        catch (System.Exception ex) {
            Debug.Log("no scroll instructions, and that is fine");
            Debug.Log(ex.ToString());
        }

        try
        {
            this.flingInstructions        = FindObjectOfType <FlingInstructions>().GetComponent <Text>();
            this.flingInstructionsPresent = true;
        }
        catch (System.Exception ex)
        {
            Debug.Log("no fling instructions, and that is fine");
            Debug.Log(ex.ToString());
        }
    }
Exemplo n.º 7
0
        private void Timer_RunTime_Tick(object sender, EventArgs e)
        {
            if (seconds_NextLevel != 0)
            {
                seconds_NextLevel--;

                string val2 = (seconds_NextLevel / 60).ToString("00") + ":" + (seconds_NextLevel % 60).ToString("00");

                NextLevelResult.Text = val2;
            }
            else
            {
                NextLevelButton.PerformClick();
            }

            //Running Time
            seconds_RunTime++;

            string val = (seconds_RunTime / 3600).ToString("00") + ":" + ((seconds_RunTime % 3600) / 60).ToString("00") + ":" + (seconds_RunTime % 60).ToString("00");

            RunTimeResult.Text = val;
        }
Exemplo n.º 8
0
 // Use this for initialization
 void Start()
 {
     next = new NextLevelButton();
 }