Exemplo n.º 1
0
    private void Start()
    {
        CursorStateModifier.ModifyCursorState(false);

        this.startGameButton = this.startGameButtonGameObject.GetComponent <Button>();
        this.startGameButton.onClick.AddListener(StartGame);

        this.continueGameButton = this.continueGameButtonGameObject.GetComponent <Button>();
        this.continueGameButton.onClick.AddListener(ContinueGame);

        this.optionsButton = this.optionsButtonGameObject.GetComponent <Button>();
        this.optionsButton.onClick.AddListener(OpenOptionsMenu);

        //Hide panel until about button is pressed
        this.aboutPanelGameObject.SetActive(false);

        this.aboutButton = this.aboutButtonGameObject.GetComponent <Button>();
        this.aboutButton.onClick.AddListener(delegate { DisplayAboutPanel(true); });

        this.quitAboutButton = this.quitAboutButtonGameObject.GetComponent <Button>();
        this.quitAboutButton.onClick.AddListener(delegate { DisplayAboutPanel(false); });

        this.quitButton = this.quitButtonGameObject.GetComponent <Button>();
        this.quitButton.onClick.AddListener(QuitApplication);
    }
 private void HandleCharacterStatisticsDoneButton()
 {
     if (this.pointsLeft == 0)
     {
         SceneManager.LoadScene("AutumnForest");
         CursorStateModifier.ModifyCursorState(true);
     }
     else
     {
         this.pointsLeftWarningLabelGameObject.SetActive(true);
     }
 }
        protected override void OnUpdate()
        {
            this.currentTime += Time.DeltaTime;

            bool hasChanged = false;

            if (this.currentTime >= TimeoutInterval)
            {
                this.Entities
                .WithAll <PlayerTag>()
                .ForEach((DynamicBuffer <InputData> inputBuffer, ref PlayerInfo playerInfo) =>
                {
                    for (int i = 0; i < inputBuffer.Length; ++i)
                    {
                        InputData input = inputBuffer[i];

                        if (input.OpenCloseInventory)
                        {
                            //If its turned on and user presses the 0pen/Close input again, then close the menu
                            if (playerInfo.OpenInventoryFromInputData)
                            {
                                playerInfo.OpenInventoryFromInputData = false;
                                hasChanged = true;

                                //When closing the inventory lock the cursor
                                CursorStateModifier.ModifyCursorState(true);
                            }
                            //Else its turned off and user presses the 0pen/Close input again, then open the menu
                            else
                            {
                                playerInfo.OpenInventoryFromInputData = true;
                                hasChanged = true;

                                //As long as the inventory is open allow the cursor to be moved and visible
                                CursorStateModifier.ModifyCursorState(false);
                            }
                        }
                    }
                }).Run();
            }

            if (hasChanged)
            {
                this.currentTime = 0f;
            }
        }