コード例 #1
0
ファイル: LevelManager.cs プロジェクト: Orlokun/JuegoColab
    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();
        }
    }
コード例 #2
0
    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();
        }
    }
コード例 #3
0
 private void HandleChangeExpHUDToClient(string[] msg)
 {
     if (NotInClientScene())
     {
         HUDDisplay hpAndMp = GameObject.FindObjectOfType <LevelManager>().hpAndMp;
         hpAndMp.CurrentExpValue(msg[1]);
     }
 }
コード例 #4
0
 private void StopChangeHPMPToClient(string[] msg)
 {
     if (NotInClientScene())
     {
         HUDDisplay hpAndMp = GameObject.FindObjectOfType <LevelManager>().hpAndMp;
         hpAndMp.StopLocalParticles(); // Only stop local particles
     }
 }
コード例 #5
0
 private void HandleChangeMpHUDToClient(string[] msg)
 {
     if (NotInClientScene())
     {
         HUDDisplay hpAndMp = GameObject.FindObjectOfType <LevelManager>().hpAndMp;
         hpAndMp.CurrentMPPercentage(float.Parse(msg[1]));
     }
 }
コード例 #6
0
    protected bool CanRegenerateHPorMP()
    {
        if (!hpAndMp)
        {
            hpAndMp = GameObject.FindObjectOfType <LevelManager>().hpAndMp;
        }

        return(hpAndMp.hpCurrentPercentage < 1f || hpAndMp.mpCurrentPercentage < 1f);
    }
コード例 #7
0
    private void HandleChangeExpHUDToClient(string[] msg)
    {
        Scene currentScene = SceneManager.GetActiveScene();

        if (currentScene.name == "ClientScene")
        {
            return;
        }
        HUDDisplay hpAndMp = GameObject.FindObjectOfType <LevelManager>().hpAndMp;

        hpAndMp.CurrentExpPercentage(msg[1]);
    }
コード例 #8
0
    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
    }
コード例 #9
0
    /// <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);
    }
コード例 #10
0
    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);
    }
コード例 #11
0
 private void Awake()
 {
     instance = this;
 }
コード例 #12
0
 /// <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();
 }
コード例 #13
0
 /// <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();
 }