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>(); }
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(); }
private void Awake() { if (!PAUSE_STATUS) { PAUSE_STATUS = GameObject.FindObjectOfType <PauseHandler>(); } }
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; }
void Start() { player = GameObject.FindGameObjectWithTag("Player").transform; nav = GetComponent <NavMeshAgent>(); mySight = GetComponent <EnemySight>(); myPause = GetComponent <PauseHandler>(); enemyHealth = GetComponent <EnemyHealth>(); anim = GetComponent <Animator>(); }
protected override void Awake() { base.Awake(); pauseHandler = FindObjectOfType <PauseHandler>(); pauseHandler.GamePauseAction += OnGamePaused; backgroundTransition = FindObjectOfType <BackgroundTransition>(); }
void Start() { camCont = FindObjectOfType <CameraController>(); holeGen = FindObjectOfType <HoleGen>(); ballCont = FindObjectOfType <BallController>(); gameCont = FindObjectOfType <GameController>(); defMats = FindObjectOfType <DefaultMats>(); pauseHandler = FindObjectOfType <PauseHandler>(); }
// 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; }
// 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); }
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); }
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); }
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; }
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; } }
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; }
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(); }
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 + ""; } }
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); }
public void SetPauseHandler(PauseHandler pauseHandler) { PauseHandler = pauseHandler; }
// Changes the time scale back to normal public void UnPause(string id) { PauseHandler.RemovePause(id); }
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); } }
// Moving the scene to the main menu scene public void Menu() { SceneManager.LoadScene(LoadLevelManager.MainMenuRef); PauseHandler.RemovePause(pauseId); }
void Start() { mySight = GetComponent <EnemySight>(); myPause = GetComponent <PauseHandler>(); enemyHealth = GetComponent <EnemyHealth>(); }