void Start() { if (!canvas) { canvas = GameObject.Find("Canvas"); } if (!canvas.activeInHierarchy) { canvas.SetActive(true); } hpAndMp = canvas.GetComponent <HUDDisplay>(); StorePlayers(); itemsOriginalPositions = new List <Vector3>(); waitToKillNPCCountdown = 5f; waitToGrabItem = 5f; npcLog = GameObject.Find("NPCLog"); npcLog.SetActive(false); reconnectText = GameObject.Find("ReconnectingText"); reconnectText.SetActive(false); if (GameObject.Find("ClientObject")) { client = GameObject.Find("ClientObject").GetComponent <Client>(); client.RequestCharIdToServer(); } }
void Start() { SetCanvas(); SetFeedbackUI(); StorePlayers(); StorePlayerControllers(); playersLastPosition = new Vector2[3]; isPlayingFeedback = false; _ = new Utils(); hpAndMp = canvas.GetComponent <HUDDisplay>(); if (GameObject.Find("PlayerFace")) { playerFaceImage = GameObject.Find("PlayerFace").GetComponent <Image>(); } else { Debug.LogError("Players Have no Face"); } waitToKillSpiderCountdown = 5f; waitToKillNPCCountdown = 5f; waitToGrabItem = 2f; currentChoice = null; if (GameObject.Find("ClientObject")) { client = GameObject.Find("ClientObject").GetComponent <Client>(); client.RequestPlayerIdToServer(); } }
private void HandleChangeExpHUDToClient(string[] msg) { if (NotInClientScene()) { HUDDisplay hpAndMp = GameObject.FindObjectOfType <LevelManager>().hpAndMp; hpAndMp.CurrentExpValue(msg[1]); } }
private void StopChangeHPMPToClient(string[] msg) { if (NotInClientScene()) { HUDDisplay hpAndMp = GameObject.FindObjectOfType <LevelManager>().hpAndMp; hpAndMp.StopLocalParticles(); // Only stop local particles } }
private void HandleChangeMpHUDToClient(string[] msg) { if (NotInClientScene()) { HUDDisplay hpAndMp = GameObject.FindObjectOfType <LevelManager>().hpAndMp; hpAndMp.CurrentMPPercentage(float.Parse(msg[1])); } }
protected bool CanRegenerateHPorMP() { if (!hpAndMp) { hpAndMp = GameObject.FindObjectOfType <LevelManager>().hpAndMp; } return(hpAndMp.hpCurrentPercentage < 1f || hpAndMp.mpCurrentPercentage < 1f); }
private void HandleChangeExpHUDToClient(string[] msg) { Scene currentScene = SceneManager.GetActiveScene(); if (currentScene.name == "ClientScene") { return; } HUDDisplay hpAndMp = GameObject.FindObjectOfType <LevelManager>().hpAndMp; hpAndMp.CurrentExpPercentage(msg[1]); }
private void StopChangeHPMPToClient(string[] msg) { Scene currentScene = SceneManager.GetActiveScene(); if (currentScene.name == "ClientScene") { return; } HUDDisplay hpAndMp = GameObject.FindObjectOfType <LevelManager>().hpAndMp; hpAndMp.StopLocalParticles(); // Only stop local particles }
/// <summary> /// Toggle the provided display. /// </summary> /// <param name="display">The display to toggle.</param> private void ToggleMenu(HUDDisplay display) { // If this display is currently active, then deactivate it. if (Equals(this.activeDisplay, display)) { this.DeactivateDisplay(display); return; } // Otherwise, deactivate the currently active menu and activate the provided one. if (this.activeDisplay != null) { this.DeactivateDisplay(this.activeDisplay); } this.ActivateDisplay(display); }
void Start() { gameManager = GameManager.instance; canvas = transform.GetChild(0).transform; inventoryPanel = Instantiate(inventoryPanelPrefab, canvas); inventoryPanel.SetActive(false); dialoguePanel = Instantiate(dialoguePanelPrefab, canvas); dialogueDisplay = dialoguePanel.GetComponent <DialogueDisplay>(); dialoguePanel.SetActive(false); hudPanel = Instantiate(hudPanelPrefab, canvas); hudDisplay = hudPanel.GetComponent <HUDDisplay>(); storePanel = Instantiate(storePanelPrefab, canvas); storePanel.SetActive(false); }
private void Awake() { instance = this; }
/// <summary> /// Deactivate the provided display. /// </summary> /// <param name="hudDisplay">The display to deactivate.</param> internal void DeactivateDisplay(HUDDisplay hudDisplay) { hudDisplay.Deactivate(); this.activeDisplay = null; this.Deactivate(); }
/// <summary> /// Activate the provided display. /// </summary> /// <param name="hudDisplay">The display to activate.</param> public void ActivateDisplay(HUDDisplay hudDisplay) { hudDisplay.Activate(); this.activeDisplay = hudDisplay; this.Activate(); }