コード例 #1
0
    public GameHudController()
    {
        _instance = this;

        _gameHudView = GameObject.Find("UI/Canvas/Panel_GameHud").GetComponent <GameHudViewPresenter>();
        _gameHudView.Show(false);

        _pauseMenuView = GameObject.Find("UI/Canvas/Panel_PauseMenu").GetComponent <PauseMenuViewPresenter>();
        _pauseMenuView.Show(false);

        _gameOverView = GameObject.Find("UI/Canvas/Panel_GameOver").GetComponent <GameOverViewPresenter>();
        _gameOverView.Show(false);

        _gameEndView = GameObject.Find("UI/Canvas/Panel_GameEnd").GetComponent <GameEndViewPresenter>();
        _gameEndView.Show(false);

        _gameHudView.PauseButton.Clicked      += Pause;
        _pauseMenuView.ResumeButton.Clicked   += Resume;
        _pauseMenuView.RestartButton.Clicked  += Restart;
        _pauseMenuView.MainMenuButton.Clicked += GoToMainMenu;
        _gameOverView.AgainButton.Clicked     += Restart;
        _gameOverView.MainMenuButton.Clicked  += GoToMainMenu;
        _gameEndView.MainMenuButton.Clicked   += GoToMainMenu;

        loadManager = (LoadManager)GameObject.Find("LoadManager").GetComponent(typeof(LoadManager));
    }
コード例 #2
0
ファイル: PlayerGUI.cs プロジェクト: PurdueSIGGD/ProjectW
    public override void PlayerComponent_Start()
    {
        if (isLocalPlayer && !myBase.myInput.isBot())
        {
            // Don't want enemy GUIs on top of ours
            GameObject instancedHudPrefab = GameObject.Instantiate(hudPrefab, myBase.myMovement.cameraRotator);
            gameHud   = instancedHudPrefab.GetComponent <GameHudController>();
            healthBar = gameHud.healthBar;
            magicBar  = gameHud.magicBar;
            myBase.myStats.hitAnimator = gameHud.hitMarker;
            spectatorUIController      = GameObject.FindObjectOfType <SpectatorUIController>();
            spectatorUIController.AssignOwner(this.gameObject, UnPauseGameWithoutUI, myBase.myNetworking.playerCameras[0]);
            foreach (Image i in gameHud.teamColoredImages)
            {
                i.color = myBase.myStats.teamColor;
            }
            // Ability icon spawning
            for (int i = 0; i < gameHud.abilityHolder.childCount; i++)
            {
                GameObject.Destroy(gameHud.abilityHolder.GetChild(i).gameObject);
            }
            abilityIcons = new AbilityIcon[myBase.myAbilities.Length];
            int abilityIndex = 0;
            foreach (PlayerAbility ability in myBase.myAbilities)
            {
                AbilityIcon icon = GameObject.Instantiate(gameHud.abilityItemPrefab, gameHud.abilityHolder).GetComponent <AbilityIcon>();
                foreach (Image i in icon.teamColoredImages)
                {
                    i.color = myBase.myStats.teamColor;
                }
                //print ("ability: " + ability + " icon: " + icon);
                icon.keyText.text = abilityText [abilityIndex];
                if (ability.abilitySprite != null)
                {
                    icon.abilityIcon.sprite     = ability.abilitySprite;
                    icon.backgroundImage.sprite = ability.abilitySprite;
                }
                abilityIcons [abilityIndex] = icon;
                ability.SetIcon(icon);
                CooldownAbility cooldownAbility;
                if (ability is CooldownAbility && (cooldownAbility = (CooldownAbility)ability))
                {
                    cooldownAbility.SetIcon(icon);
                }
                abilityIndex++;
            }

            UnPauseGame();
        }
        else
        {
        }
    }
コード例 #3
0
    // Initialization
    void Start()
    {
        _gameHudController = new GameHudController();

        _gameHudController.ShowGameHud(true);
    }