public static void ResumeProtection()
 {
     PauseProtectionSpan = TimeSpan.Zero;
     IsProtectionPaused  = false;
     PauseHandler.Stop();
     CurrentMainPage.ProtectionState = GuardStates.Protecting;
 }
 // Start is called before the first frame update
 void Start()
 {
     controller       = GetComponent <CharacterController>();
     Cursor.lockState = CursorLockMode.Locked;
     cam     = FindObjectOfType <Camera>().transform;
     myPause = GetComponent <PauseHandler>();
 }
Example #3
0
        void Awake()
        {
            if (!_instance)
            {
                _instance = this;
            }

            if (maxParticleCount <= 0)
            {
                Debug.LogError("maxParticleCount must be greater than zero");
            }

            _pauseStatus   = GameObject.FindObjectOfType <PauseHandler>();
            _particleArray = new CircularArray <CustomParticle> (maxParticleCount);

            for (int i = 0; i < _particleArray.Capacity; i++)
            {
                var particle = Instantiate(particlePrefab);
                particle.transform.SetParent(transform);
                particle.SetActive(false);
                _particleArray [i] = particle.GetComponent <CustomParticle> ();
            }

            CustomParticle.UpdateEffectorList();
        }
Example #4
0
 private void Awake()
 {
     if (!PAUSE_STATUS)
     {
         PAUSE_STATUS = GameObject.FindObjectOfType <PauseHandler>();
     }
 }
Example #5
0
    void Awake()
    {
        //Fetch Components
        ballCont         = FindObjectOfType <BallController>();
        holeGen          = this.GetComponent <HoleGen>();
        inputHandler     = this.GetComponent <InputHandler>();
        holeThemeHandler = this.GetComponent <HoleThemeHandler>();
        defMats          = this.GetComponent <DefaultMats>();
        pauseHandler     = FindObjectOfType <PauseHandler>();
        fadeImage        = GameObject.Find("BlackFade").GetComponent <Image>();
        holeResultText   = GameObject.Find("HoleResultText").GetComponent <TextMeshProUGUI>();

        //Instantiate our GameData prefab if it doesn't already exist.
        if (!FindObjectOfType <GameData>())
        {
            gameData = Instantiate(gameDataPrefab).GetComponent <GameData>();
        }
        else
        {
            gameData = FindObjectOfType <GameData>();
        }

        //Select the relevant scoreboard
        SelectScoreboard(gameData.gameMode, gameData.noHoles);

        //Set Vsync
        QualitySettings.vSyncCount = 0;
    }
Example #6
0
 void Start()
 {
     player      = GameObject.FindGameObjectWithTag("Player").transform;
     nav         = GetComponent <NavMeshAgent>();
     mySight     = GetComponent <EnemySight>();
     myPause     = GetComponent <PauseHandler>();
     enemyHealth = GetComponent <EnemyHealth>();
     anim        = GetComponent <Animator>();
 }
Example #7
0
    protected override void Awake()
    {
        base.Awake();

        pauseHandler = FindObjectOfType <PauseHandler>();
        pauseHandler.GamePauseAction += OnGamePaused;

        backgroundTransition = FindObjectOfType <BackgroundTransition>();
    }
Example #8
0
 void Start()
 {
     camCont      = FindObjectOfType <CameraController>();
     holeGen      = FindObjectOfType <HoleGen>();
     ballCont     = FindObjectOfType <BallController>();
     gameCont     = FindObjectOfType <GameController>();
     defMats      = FindObjectOfType <DefaultMats>();
     pauseHandler = FindObjectOfType <PauseHandler>();
 }
Example #9
0
    // Start is called before the first frame update
    void Start()
    {
        Instance = this;

        left  = button.transform.GetChild(0).GetComponent <RectTransform>();
        lpos  = left.localPosition;
        right = button.transform.GetChild(1).GetComponent <RectTransform>();
        rpos  = right.localPosition;
    }
Example #10
0
        // The public variable for other classes to access the progress

        // Clearing the pause at the start
        public void Start()
        {
            staticSlider        = sliderObject;
            staticPercentage    = loadingPercentage;
            staticLoadingSlider = loadingSlider;

            animator = GetComponent <Animator>();
            PauseHandler.RemovePause(PauseId);
            loadLevel?.Stop();
            sliderObject.SetActive(false);
        }
Example #11
0
        public static void LoadLevel(string sceneRef)
        {
            // Starting the fade out animation
            animator.SetTrigger(FadeOut);

            // Create a new task starting the loading of the larger scene
            loadLevel = new Task(LoadAsynchronously(sceneRef), false);

            // Pause the game
            PauseHandler.Pause(PauseId);
        }
Example #12
0
 private void Awake()
 {
     if (gm == null)
     {
         gm = this;
         DontDestroyOnLoad(this.gameObject);
     }
     else
     {
         Destroy(this.gameObject);
     }
     ph = GetComponent <PauseHandler>();
 }
        public IEnumerator TestPausePanelCanTurnOn()
        {
            PauseHandler script   = manager.GetComponent <PauseHandler>();
            bool         previous = GameObject.Find("Pause");

            script.SwitchPausePanel();

            yield return(null);

            bool result = GameObject.Find("Pause");

            Time.timeScale = 1;

            Assert.AreNotEqual(previous, result);
        }
Example #14
0
    private IEnumerator LoadCoroutine(string newScene)
    {
        // Disable pausing and movement
        PauseHandler.canPause = false;
        PauseHandler.paused   = true;
        Time.timeScale        = 0;
        try {
            PlayerController.pc.currentForm = PlayerController.Form.Test;
            PlayerController.pc.canAct      = false;
        } catch { }

        // Activate loading screen
        canvas.enabled = true;
        loading        = true;

        // Load and unload scenes
        Scene oldScene = SceneManager.GetActiveScene();

        yield return(StartCoroutine(GameManager.gm.LoadAsync(newScene)));

        yield return(StartCoroutine(GameManager.gm.UnloadAsync(oldScene)));

        GameManager.gm.SetScene(newScene);
        yield return(null);

        // Enable pausing and movement, deactivate loading screen
        try {
            PlayerController.pc.canAct = true;
        } catch { }
        CanvasManager.cm.GetComponent <Canvas>().enabled = true;
        if (newScene != "MainMenu")
        {
            PlayerController.pc.FindNewPawn();
            yield return(new WaitForSecondsRealtime(0.05f));

            PauseHandler.canPause = true;
            PauseHandler.paused   = false;
            Time.timeScale        = 1;
        }
        else
        {
            PauseHandler.SetMenu(false);
        }
        canvas.enabled = false;
        loading        = false;
    }
Example #15
0
        public void Update()
        {
            // Checks whether the conversation
            if (!DialogueManager.IsSpeaking() && hasSpoken)
            {
                // Opens the upgrade menu
                upgradeMenu.SetActive(true);

                // Pauses the game
                PauseHandler.Pause("skillTree");

                // Change the beginning of the speech
                dialogue.SetStartingContents(reuseDialogue.StartSpeech());

                hasSpoken = false;
            }
        }
Example #16
0
        public void ChangePause()
        {
            isPaused = !isPaused;

            // Turn the pause menu on or off depending on if the
            // game is paused or not
            pauseMenuUi.SetActive(isPaused);

            // Change the time scale also accordingly
            if (isPaused)
            {
                PauseHandler.Pause(pauseId);
            }
            else
            {
                PauseHandler.RemovePause(pauseId);
            }
        }
        public static void PauseProtection(TimeSpan pauseDuration)
        {
            if (CheckIfResting())
            {
                return;
            }

            if (Configuration.SaveStats)
            {
                UpdateIntruptOfStats(GuardStates.PausedProtecting);
            }
            PauseProtectionSpan = pauseDuration;
            UpdatePauseTimeString();
            IsProtectionPaused = true;
            PauseHandler.Start();

            CurrentMainPage.ProtectionState = GuardStates.PausedProtecting;
        }
Example #18
0
 public LevelController(
     MonoBehaviour coroutineRunner,
     LevelControls levelControls,
     EventBus gameEventBus,
     StartHandler startHandler,
     PauseHandler pauseHandler,
     DeathHandler deathHandler,
     ResetHandler resetHandler,
     FinishHandler finishHandler)
 {
     _coroutineRunner = coroutineRunner;
     _levelControls   = levelControls;
     _gameEventBus    = gameEventBus;
     _startHandler    = startHandler;
     _pauseHandler    = pauseHandler;
     _deathHandler    = deathHandler;
     _resetHandler    = resetHandler;
     _finishHandler   = finishHandler;
 }
        static void Main(string[] args)
        {
            Program      p       = new Program();
            PauseHandler handler = p.Pause;

            List <ComputingDevice> computingDevices = new List <ComputingDevice>();

            computingDevices.Add(new Desktop(4, 3.2, 8, "SSD", "HDMI"));
            computingDevices.Add(new Server(16, 3.2, 128, "RAID", "Generic"));
            computingDevices.Add(new Tablet(2, 2.4, 2, "SSD", "Onboard"));

            foreach (ComputingDevice device in computingDevices)
            {
                device.Display();
            }

            handler();
            Console.ReadKey();
        }
Example #20
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.name == "Popo")
        {
            player = GameObject.Find("Popo");
            pb     = player.GetComponent <PlayerBehaviour> ();
            //finishedPanel = GameObject.Find("FinishPanel");

            pb.enabled = false;
            finishedPanel.SetActive(true);
            GameObject canvas = GameObject.Find("Canvas");
            pauseHandler = canvas.GetComponent <PauseHandler> ();
            pauseHandler.pauseMenuButton.SetActive(false);

            scoreToDisplayText = GameObject.Find("scoreValue").GetComponent <Text>();
            GameObject   scoreManager = GameObject.Find("ScoreManager");
            ScoreCounter scoreCounter = scoreManager.GetComponent <ScoreCounter> ();
            scoreToDisplayText.text = scoreCounter.Score + "";
        }
    }
Example #21
0
    void Start()
    {
        playersFin     = new List <GameObject>();
        FadeScript     = FadeSceneObject.GetComponent <Fade>();
        count          = 0;
        trapsPlaced    = false;
        placeTrapsOnce = false;
        TrapSelect.SetActive(true);
        pH       = gameObject.GetComponent <PauseHandler>();
        pH.start = false;


        LeaderBoard.SetActive(false);
        time          = 120;
        playerControl = PlayerControl.instance;
        if (!playerControl.players[1])
        {
            Player2.SetActive(false);
            Player2HUD.SetActive(false);
        }

        if (!playerControl.players[2])
        {
            Player3.SetActive(false);
            Player3HUD.SetActive(false);
        }

        if (!playerControl.players[3])
        {
            Player4.SetActive(false);
            Player4HUD.SetActive(false);
        }

        players = GameObject.FindGameObjectsWithTag("Player");
        for (int i = 0; i < players.Length; i++)
        {
            players[i].GetComponent <PlayerMovement>().enabled = false;
        }

        loseButton.gameObject.SetActive(false);
    }
Example #22
0
 public void SetPauseHandler(PauseHandler pauseHandler)
 {
     PauseHandler = pauseHandler;
 }
Example #23
0
 // Changes the time scale back to normal
 public void UnPause(string id)
 {
     PauseHandler.RemovePause(id);
 }
Example #24
0
        private void Movement()
        {
            var grid = movement.GetGrid();

            if (grid == null)
            {
                return;
            }

            // Finding the position of the mouse
            Vector2 mousePosition = mainCamera.ScreenToWorldPoint(Input.mousePosition);

            // Find the corresponding index for the vector
            var mouseIndex = grid.VectorCoordinates(mousePosition);

            // If the player has a current helper, it would start moving to that helper
            if (currentHelper != null)
            {
                // Getting the player stand position
                var standPosition = currentHelper.GetStandPosition();

                // Checks if the player is close enough to the stand position
                if (Vector2.Distance(transform.position, standPosition) > 0.5f)
                {
                    movement.StartMoving(currentHelper.GetStandPosition());
                }
                else if (!isBusy)
                {
                    currentHelper.ReadyToTalk();
                    isBusy = true;
                }
            }

            // Check if the mouse is pressed
            if (Input.GetMouseButton(1))
            {
                // Clears the current target and helper for the player
                currentTarget = null;
                currentHelper = null;

                // Clears the holder
                holder = "";
                ClearDraw();

                // Checking if the mouse is within the confines of the map
                if (grid.isOnGrid(mouseIndex))
                {
                    // Starts the A* algorithm for the given position
                    movement.StartMoving(mousePosition);
                }
            }

            // Checks if the mouse has been pressed to find an enemy only when the
            // player isn't casting
            if (Input.GetMouseButtonDown(0) && !isCasting && !PauseHandler.IsPaused())
            {
                // Checks if there is an enemy around that point
                currentTarget = gameMaster.CheckPerson <Enemy>(mousePosition);
                if (currentTarget == null || !currentTarget.IsAlive())
                {
                    currentTarget = null;
                }

                // Checks if there is a helper around the point where you click
                currentHelper = gameMaster.CheckPerson <Helper>(mousePosition);
            }
        }
Example #25
0
 // Moving the scene to the main menu scene
 public void Menu()
 {
     SceneManager.LoadScene(LoadLevelManager.MainMenuRef);
     PauseHandler.RemovePause(pauseId);
 }
Example #26
0
 void Start()
 {
     mySight     = GetComponent <EnemySight>();
     myPause     = GetComponent <PauseHandler>();
     enemyHealth = GetComponent <EnemyHealth>();
 }