Beispiel #1
0
 public void Menu()
 {
     menuOpen = !menuOpen;
     MenuPanel.SetActive(menuOpen);
     if (!pause.GamePaused)
     {
         pause.Pause();
     }
 }
Beispiel #2
0
 public void Resume()
 {
     if (pg != null)
     {
         pg.Pause();
     }
 }
Beispiel #3
0
    public static void QuickLoad()
    {
        PauseGame.Pause(false);
        string w = "Load Last QuickSave? ";

        w += "\n All unsaved Progress will be lost.";
        PauseGame.DisplayWarning(w, Instance.m_pauseMenuUI, Instance.quickLoad, "Warning", Instance.SetFirstOption);
    }
Beispiel #4
0
    public void QuickLoad()
    {
        PauseGame.Pause(false);
        string w = "Load Last QuickSave? ";

        w += "\n All unsaved Progress will be lost.";
        WarningMessage.DisplayWarning(w, m_pauseMenuUI, quickLoad, "Warning", SetFirstOption);
    }
Beispiel #5
0
    // Update is called once per frame
    void Update()
    {
        //print ("hor = " + horiInput);
//		switch(CurrFrameType){
//		case FrameType.Active:
//			break;
//		case FrameType.Recovery:
//			break;
//		case FrameType.Startup:
//			break;
//		case FrameType.Regular:
//			QueueInput ();
//			RegisterQueue ();
//			break;
//		}
        //if(flip){
        //	ToggleDirection ();
        //}
        if (canAttack)
        {
            QueueAttackInput();
        }
        if (canMove)
        {
            QueueMovementInput();
        }

        CheckForCombo();
        if (lockOnTargets.Count != 0)
        {
            if (Input.GetButtonDown(controllerVariables.lockOnInput))
            {
                if (lockOnTarget == lockOnTargets [0])
                {
                    lockOnTarget = lockOnTargets [1];
                }
                else
                {
                    lockOnTarget = lockOnTargets [0];
                }
                CheckTarget(lockOnTarget);
            }
//			if (checkDelay < 10) {
//				print ("check");
//
//			}
//			checkDelay++;
        }
        if (Input.GetButtonDown(controllerVariables.startButton))
        {
            Debug.Log("yes");
            PauseGame pauseGame = FindObjectOfType <PauseGame>();
            pauseGame.Pause(playerNumber);
        }
    }
Beispiel #6
0
    void Awake()
    {
        btn     = GetComponent <Button> ();
        btnName = btn.GetComponentInChildren <Text>().text;

        GameObject UI = GameObject.Find("UI Controller");

        if (UI != null)
        {
            pg = UI.GetComponent <PauseGame> ();
            pg.Pause();
        }

        switch (btnName)
        {
        case "Play":
            btn.onClick.AddListener(delegate { ChangeScene("Prologue"); });
            break;

        case "Main Menu":
            btn.onClick.AddListener(delegate { ChangeScene("Splash"); });
            break;

        case "Instructions":
            btn.onClick.AddListener(delegate { ChangeScene("Instructions"); });
            break;

        case "Credits":
            btn.onClick.AddListener(delegate { ChangeScene("Credits"); });
            break;

        case "Quit":
            btn.onClick.AddListener(Quit);
            break;

        case "Resume":
            btn.onClick.AddListener(Resume);
            break;

        case "Mute":
            btn.onClick.AddListener(Mute);
            break;

        case "Next":
            btn.onClick.AddListener(delegate { ChangeScene(next); });
            break;

        default:
            btn.onClick.AddListener(delegate { ChangeScene(next); });
            break;
        }
    }
Beispiel #7
0
 public void StartDialogue(Dialogue dialogue)
 {
     pauseGame.Pause(dialogueCanvas);
     dialogueCanvas.SetActive(true);
     animator.SetBool("IsOpen", true);
     nameText.text = dialogue.name;
     sentences.Clear();
     foreach (string sentence in dialogue.sentences)
     {
         sentences.Enqueue(sentence);
     }
     DisplayNextSentence();
 }
Beispiel #8
0
        void IUIScreenController.OpenScreen(ScreenType.ScreenType screenType)
        {
            PauseGame.Pause(true);
            _Input.SetUIMap();
            OpenScreenRequest?.Invoke(screenType);

            if (!_OpenScreenStack.Contains(screenType))
            {
                _OpenScreenStack.Push(screenType);
            }

            ScreenPointer.SetEnabled(false);
        }
Beispiel #9
0
    // Update is called once per frame
    void Update()
    {
        /*
         * // Create enemy
         * spawn = GameObject.FindGameObjectsWithTag("Enemies");
         * if (spawn.Length < 5)
         * {
         *  Instantiate(enemies[Random.Range(0, enemies.Length)], spawnPos[Random.Range(0,spawnPos.Length)].transform.position, Quaternion.identity);
         * }
         */

        if (timeWaitBegin > 0)
        {
            timeWaitBegin -= Time.deltaTime;
        }
        else
        {
            if (!startGame)
            {
                pauseGame.Pause(inputWindow);
                startGame = true;

                AstarPath.active.Scan();
            }
        }


        // Check gameover
        if (playerAnimator.GetCurrentAnimatorStateInfo(0).IsName("Death") && playerAnimator.GetCurrentAnimatorStateInfo(0).normalizedTime >= 1.0f)
        {
            if (!endGame)
            {
                GameOver();
                endGame = true;
            }
        }
    }
    /// <summary>
    /// The exit key is pressed
    /// The behaviour in all campaign scenes is similar
    /// Canvas Fail appears with exit-key text
    /// In Sandbox the end screen is called
    /// </summary>
    protected virtual void ExitKeyPressed()
    {
        // in campaign mode show fail screen
        if (CanvasEscape != null)
        {
            // disable press space begin canvas first
            // otherwise this will disturb the button control
            // of CanvasFail
            if (PressSpaceCanv != null)
            {
                PressSpaceCanv.SetActive(false);
            }

            CanvasEscape.SetActive(true);
            FindAndPlaceHuman(CanvasEscape);
            PauseGame.Pause();
        }
    }
Beispiel #11
0
    //called when something enters the trigger of the object this script is assigned to
    void OnTriggerEnter2D(Collider2D other)
    {
        //if a laser collides with this object
        if (other.gameObject.name.Contains("aser"))
        {
            TypeOfLaser typeOfLaser = other.GetComponent("TypeOfLaser") as TypeOfLaser;

            //if a player or invader has been hit
            if (gameObject.name.StartsWith("Invader") || gameObject.name.Equals("Player"))
            {
                //if it has been hit by the opposite laser
                if (typeOfLaser.getTypeOfLaser() != LaserType.Invader && typeOfLaser.getTypeOfLaser() != LaserType.Player)
                {
                    //take damage
                    damage = other.gameObject.GetComponent("Damage") as Damage;
                    Debug.Log(gameObject.name + "has been hit by a laser of type " + typeOfLaser.getTypeOfLaser().ToString());
                    takeDamage(damage.getDamage());
                }
            }
            else if (gameObject.name.Equals("man"))
            {
                //if the man gets hit
                if (typeOfLaser.getTypeOfLaser() != LaserType.Man)
                {
                    damage = other.gameObject.GetComponent("Damage") as Damage;
                    //play audio
                    audioS.PlayOneShot(deadFX, 0.35F);
                    //take damage
                    takeDamage(damage.getDamage());
                    //destroy laser
                    Destroy(other.gameObject);
                    //pause the game for a second
                    StartCoroutine(pause.Pause(1, true));
                }
            }
            else
            {
                //otherwise, take damage.
                damage = other.gameObject.GetComponent("Damage") as Damage;
                takeDamage(damage.getDamage());
            }
        }
    }
Beispiel #12
0
    void OnTriggerEnter(Collider other)
    {
        if (!give_gun)
        {
            if (other.gameObject.tag == "Player")
            {
                give_gun = true;

                BKControllerController[] badonks =
                    BKHolder.GetComponentsInChildren <BKControllerController>();
                foreach (BKControllerController bkc in badonks)
                {
                    bkc.activate_chase();
                }

                pause.enablePenguinScreen();
                pause.Pause();
                pc.setGun(true);
            }
        }
    }
    protected virtual void Update()
    {
        if (levelHasFinished)
        {
            // We do nothing if the level is already finished
            return;
        }

        // if the player is exposed we fail
        if (!levelHasFinished)
        {
            levelHasFinished = EndGamePlayerExposed();
        }

        // if the player is at home and well we win
        if (!levelHasFinished)
        {
            levelHasFinished = EndGamePlayerAtHome();
        }

        // if the user wants the game to end
        // we show the stats screen if we are in the sandbox
        // or the fail screen in the campaign mode
        if (!levelHasFinished && Input.GetKeyDown(KeyCode.Q))
        {
            ExitKeyPressed();
            levelHasFinished = true;
        }

        // TESTING ONLY
        // if the user wants the game to end
        // we show the stats screen if we are in the sandbox
        // or the fail screen in the campaign mode
        if (testMode && !levelHasFinished && Input.GetKeyDown(KeyCode.C))
        {
            EndLevelWithSuccess();
            levelHasFinished = true;
            PauseGame.Pause();
        }
    }
Beispiel #14
0
    /// <summary>
    /// Checks if the player gets the toilet paper, i.e.
    /// if he went to both supermarkets. Displays explanations
    /// when supermarket is out of toilet paper.
    /// </summary>
    private IEnumerator PlayerInSupermarket(Player p)
    {
        // player already hit one empty supermarket
        // and make sure he was not here before
        if (p.wentToFirstSupermarket)
        {
            // player gets toilet paper
            p.hasToiletpaper = true;
            // wait a little to let the paper disappear
            yield return(new WaitForSeconds(0.3f));

            Toiletpaper.SetActive(false);
            // player has toilet paper
            NumberOfRolls.GetComponent <TMPro.TMP_Text>().text = "1";
            // Pause the game
            PauseGame.Pause();
            CanvasSupermarket.SetActive(true);
            CanvasSupermarket.GetComponentInChildren <TMP_Text>().text = "You got one last roll of " +
                                                                         "FeatherSoft Ultra Premium 3D Embossed StrawberryVanilla flavored" +
                                                                         " toilet paper.\nPress 'Space' to continue.";
            CanvasSupermarket.GetComponentInChildren <TMP_Text>().fontSize = 25;
            GetComponent <AlreadyWasHere>().PlayerWasHere();
        }
        else
        {
            // wait a little to let the paper disappear
            yield return(new WaitForSeconds(0.3f));

            Toiletpaper.SetActive(false);
            // Pause the game
            PauseGame.Pause();
            // show the canvas telling the player that the sm is out
            // has press-space script attached to it
            CanvasSupermarket.SetActive(true);
            // remember that we went to first supermarket
            p.wentToFirstSupermarket = true;
            // remember that we went to this specific supermarket
            GetComponent <AlreadyWasHere>().PlayerWasHere();
        }
    }
 protected override void Update()
 {
     // Check if we collected all masks and returned them to the hospital.
     // If so, pause the game and show a screen telling us to get home.
     if (!LevelSettings.GetActiveEndLevelController().levelHasFinished&& ShowCanvasAllCollectedGetHome())
     {
         // The player has collected all masks and brought them to the hospital.
         // Get a reference to the player.
         Components.Player player = GameObject.FindWithTag("Player").GetComponent <Components.Player>();
         // Set the number of masks of the player to 0,
         // since he gave his masks to the hospital.
         player.addMasks(-player.getNumMasks());
         // Pause the game
         PauseGame.Pause();
         // Show the pause message that tells him to get home.
         // This canvas has a "space-to-continue"-script attached
         CanvasAllCollectedGetHome.SetActive(true);
         // Set internal bool that the player is now on its way home
         onWayHome = true;
     }
     base.Update();
 }
Beispiel #16
0
 public void OnTriggerEnter(Collider other)
 {
     pauseScript.Pause();               //Pause the game
     BallMovementText.SetActive(false); //Remove the tutorial text about the movement
     CrabCanvas.SetActive(true);        //Display the tutorial canvas about the obstacles
 }
 public void OnTriggerEnter(Collider other)
 {
     pauseScript.Pause();            //Pause the game
     CrabCanvas.SetActive(false);    //Remove the tutorial canvas about the obstacles
     UmbrellaCanvas.SetActive(true); //Display the tutorial canvas about the platforms
 }
Beispiel #18
0
    // Update is called once per frame
    void Update()
    {
        if (eTime.currentMonth == 5 && newMonthNextDay)          //Generate the request, tell the player
        {
            newMonthNextDay = false;
            RequestPanel.SetActive(true);

            pause.Pause();
            Debug.Log(pause.GamePaused);
            requestFulfilled = false;
            SaveFileControl.control.RequestFulfilled = requestFulfilled;
            requestedResource = Random.Range(1, 5);
            SaveFileControl.control.RequestedResource = requestedResource;
            if (requestedResource == 1)              //gold
            {
                RequestText.text = "This year I would like your harvest payment in the form of 50 Gold. As always I'll expect it in November.";
                if (resources.PlayerGold >= 50)
                {
                    SendNowButton.enabled = true;
                }
                else
                {
                    SendNowButton.enabled = false;
                }
            }
            else if (requestedResource == 2)                //food
            {
                RequestText.text = "This year I would like your harvest payment in the form of 150 Food. As always I'll expect it in November.";
                if (resources.PlayerFood >= 150)
                {
                    SendNowButton.enabled = true;
                }
                else
                {
                    SendNowButton.enabled = false;
                }
            }
            else if (requestedResource == 3)                //wood
            {
                RequestText.text = "This year I would like your harvest payment in the form of 100 Wood. As always I'll expect it in November.";
                if (resources.PlayerWood >= 100)
                {
                    SendNowButton.enabled = true;
                }
                else
                {
                    SendNowButton.enabled = false;
                }
            }
            else if (requestedResource == 4)                //stone
            {
                RequestText.text = "This year I would like your harvest payment in the form of 100 Stone. As always I'll expect it in November.";
                if (resources.PlayerStone >= 100)
                {
                    SendNowButton.enabled = true;
                }
                else
                {
                    SendNowButton.enabled = false;
                }
            }
            PB.EndPlacement();
            RB.Removing = false;
        }
        if (eTime.currentMonth == 12 && newMonthNextDay && !requestFulfilled)
        {
            newMonthNextDay = false;
            LiegeOpinion    = LiegeOpinion - 15;
            SaveFileControl.control.LiegeOpinion = LiegeOpinion;
            DeniedPanel.SetActive(true);
            pause.Pause();
        }
        if (eTime.currentMonth == 11 && newMonthNextDay)
        {
            newMonthNextDay = false;
            if (requestFulfilled)
            {
                FulfilledPanel.SetActive(true);
                pause.Pause();
                FulfilledText.text = "Thank you for your shipment.";
                PB.EndPlacement();
                RB.Removing = false;
            }
            else
            {
                RequestPanel.SetActive(true);

                pause.Pause();
                if (requestedResource == 1)                  //gold
                {
                    RequestText.text = "It is time for your harvest payment of 50 Gold";
                    if (resources.PlayerGold >= 50)
                    {
                        SendNowButton.enabled = true;
                    }
                    else
                    {
                        SendNowButton.enabled = false;
                    }
                }
                else if (requestedResource == 2)                    //food
                {
                    RequestText.text = "It is time for your harvest payment of 150 Food";
                    if (resources.PlayerFood >= 150)
                    {
                        SendNowButton.enabled = true;
                    }
                    else
                    {
                        SendNowButton.enabled = false;
                    }
                }
                else if (requestedResource == 3)                    //wood
                {
                    RequestText.text = "It is time for your harvest payment of 100 Wood";
                    if (resources.PlayerWood >= 100)
                    {
                        SendNowButton.enabled = true;
                    }
                    else
                    {
                        SendNowButton.enabled = false;
                    }
                }
                else if (requestedResource == 4)                    //stone
                {
                    RequestText.text = "It is time for your harvest payment of 100 Stone.";
                    if (resources.PlayerStone >= 100)
                    {
                        SendNowButton.enabled = true;
                    }
                    else
                    {
                        SendNowButton.enabled = false;
                    }
                }
                PB.EndPlacement();
                RB.Removing = false;
            }
        }
        if (eTime.NewMonth)
        {
            newMonthNextDay = true;
        }
        else
        {
            newMonthNextDay = false;
        }
    }
Beispiel #19
0
 public void ShowPanel()
 {
     Panel.SetActive(true);
     InfoText.text = "Click one of the above buttons to see more information about your fiefdom";
     pause.Pause();
 }
Beispiel #20
0
 public void HandleClick()
 {
     isMenuActive = !isMenuActive;
     pause.Pause(isMenuActive);
     menu.SetActive(isMenuActive);
 }
Beispiel #21
0
 /// <summary>
 /// When the LosePanel object is enabled, pause the game
 /// </summary>
 private void OnEnable()
 {
     pause.Pause(true);
 }
 public void OnTriggerEnter(Collider other)
 {
     pauseScript.Pause();                //Pause the game
     MovingCrabCanvas.SetActive(false);  //Remove the tutorial canvas about the moving obstacles
     KillPlatformCanvas.SetActive(true); //Display the tutorial canvas about the kill platforms
 }