예제 #1
0
    public static void Update(MenuState newState)
    {
        state = newState;
        switch (state)
        {
        case MenuState.MainMenu:
            MainUI.SetActive(false);
            BossUI.SetActive(false);
            DeathUI.SetActive(false);
            PauseMenu.SetActive(false);
            TitleScreen.SetActive(true);
            break;

        case MenuState.Paused:
            PauseMenu.SetActive(true);
            break;

        case MenuState.Dead:
            MainUI.SetActive(false);
            BossUI.SetActive(false);
            PauseMenu.SetActive(false);
            TitleScreen.SetActive(false);
            DeathUI.SetActive(true);
            break;

        case MenuState.Playing:
            PauseMenu.SetActive(false);
            TitleScreen.SetActive(false);
            DeathUI.SetActive(false);
            MainUI.SetActive(true);
            break;
        }
    }
예제 #2
0
    void FadeOut()
    {
        delayCounter -= 1;
        diffHeight   += movingSpeed;
        if (delayCounter <= 0)
        {
            _textAlpha = Mathf.Lerp(_textAlpha, 0, Time.deltaTime * 5);
        }
        if (_textAlpha <= 0.1f)
        {
            showUI       = false;
            delayCounter = 120;
            diffHeight   = 0.0f;
            foreach (DamageUI ui in UIItems)
            {
                if (ui.Chess.GetComponent <CharacterProperty>().Hp <= 0)
                {
                    DeathUI dUI = new DeathUI(ui.Chess, ui.Attacker);
                }
                else
                {
                    RoundUI rUI = Camera.mainCamera.GetComponent <RoundUI>();
                    rUI.Wait = false;
                }
            }

            UIItems.Clear();
        }
    }
예제 #3
0
 private void die()
 {
     Debug.Log("Player " + netId + " has died");
     animator.SetTrigger("isDead");
     isDead = true;
     Debug.Log("Win UI shown");
     deathScreen = FindObjectOfType <DeathUI>();
     deathScreen.GetComponent <Canvas>().enabled = true;
 }
예제 #4
0
    public override void OnStartLocalPlayer()
    {
        Camera.main.transform.SetParent(transform);
        Camera.main.transform.localPosition = new Vector2(0, 0);

        playerNameObj.transform.localPosition = new Vector2(-0.05f, 0.25f);
        playerNameObj.transform.localScale    = new Vector2(0.1f, 0.1f);

        string name = PlayerNameInput.DisplayName;

        CmdSetupPlayer(name);

        //Setting stats
        maxHp      = 100;
        currentHp  = maxHp;
        experience = 0;
        level      = 1;

        //If player is host and client, auto ready
        if (!isClientOnly)
        {
            isReady = true;
        }

        if (SceneManager.GetActiveScene().buildIndex == 2)
        {
            /*
             * NetworkManager2 nm2 = FindObjectOfType<NetworkManager2>();
             * nm2.checkPlayerClass(netIdentity.netId);*/
            //Finding components
            NetworkManager3 nm3 = FindObjectOfType <NetworkManager3>();
            nm3.checkPlayerClass(netIdentity.netId);
            talentTree  = FindObjectOfType <TalentTree>();
            hud         = GameObject.FindGameObjectWithTag("HUD").GetComponent <HUD>();
            deathScreen = FindObjectOfType <DeathUI>();
            winScreen   = FindObjectOfType <WinUI>();

            talentTree.GetComponent <Canvas>().enabled = false;
            CmdSetMaxHealth(currentHp, maxHp, netId);
            CmdSetMaxExp(experience, 100, level, netId);
        }
        else if (SceneManager.GetActiveScene().buildIndex == 1)
        {
            //Finding components
            hud = GameObject.FindGameObjectWithTag("HUD").GetComponent <HUD>();

            CmdSetMaxHealth(currentHp, maxHp, netId);
            CmdSetMaxExp(experience, 100, level, netId);
        }

        activateClassScripts();
    }
예제 #5
0
 public static void Show()
 {
     if (Instance != null)
     {
         Instance.gameObject.SetActive(true);
     }
     else
     {
         Instance = UISystem.InstantiateUI("DeathUI").GetComponent <DeathUI>();
     }
     InputManager.enabled = false;
     PlayerController.LockCursor(false);
 }
예제 #6
0
 private void Awake()
 {
     I = this;
 }
예제 #7
0
 void Awake()
 {
     instance = this;
 }