Example #1
0
        public void InitScene()
        {
            GameObject background = new GameObject(new Vector2(SceneManager.ScreenSize.X, 400, SceneManager.ScreenSize.X, 0), "", new Vector2(0, 250));

            background.Animator.AddTexture("BACKGROUND", new Bitmap("./Textures/BACKGROUND.png"), 3, 2000);
            background.Animator.CurrentTexture = "BACKGROUND";
            SceneManager.AddObject(background);

            GameObject sun = new GameObject(new Vector2(230, 300), "Sun", new Vector2(10, -25));

            sun.Animator.AddTexture("SUN", new Bitmap("./Textures/SUN.png"));
            sun.Animator.CurrentTexture = "SUN";
            SceneManager.AddObject(sun);

            menuHUD = new MenuHUD(gl);
            menuHUD.Init();
            SceneManager.HUD = menuHUD;

            // Play games' song
            long position;

            try {
                position = OutputDevice.GetPosition();
            } catch {
                position = 0;
            }

            if (position == 0)
            {
                keepPlaying = true;
                OutputDevice.PlaybackStopped += SongStopped;
                OutputDevice.Init(audioFile);
                OutputDevice.Play();
            }
        }
Example #2
0
        private void ServerManager_OnGettingDatasSuccess(PlayerDatas playerDatas)
        {
            PlayerDatas = playerDatas;

            MenuHUD lMainMenu = MenuHUD.Instance;

            uiManager.AddScreen(lMainMenu);
            uiManager.AddScreenWithoutCloseAScreen(LevelSelector.Instance, lMainMenu);
        }
Example #3
0
    public override void _Ready()
    {
        this.globals = (Autoload)GetNode("/root/Autoload");

        bgm = GetNode("BGM") as AudioStreamPlayer;
        hud = GetNode("HUD") as MenuHUD;

        hud.Connect("StartGame", this, "NewGame");

        SetProcess(false);
        bgm.Play();
    }
Example #4
0
    // Start is called before the first frame update
    void Start()
    {
        MechHUD                = transform.Find("MechHUD").gameObject;
        SwitcherHUD            = transform.Find("SwitcherHUD").gameObject;
        NavHUD                 = transform.Find("NavHUD").gameObject;
        MenuHUD                = transform.Find("MenuHUD").gameObject;
        ScoreHUD               = transform.Find("ScoreHUD").gameObject;
        GunHUD                 = transform.Find("GunHUD").gameObject;
        slotHighlightTransform = SwitcherHUD.transform.GetChild(0).GetComponent <RectTransform>();

        slotImages   = new List <GameObject>();
        slotPos      = slotHighlightTransform.anchoredPosition;
        slotPosDelta = new Vector3(80, 0, 0);

        MechHUD.SetActive(false);
        SwitcherHUD.SetActive(true);
        NavHUD.SetActive(false);
        MenuHUD.SetActive(false);
        GunHUD.SetActive(false);
        ScoreboardUI(false);

        self.SetActive(false);
    }
Example #5
0
 public void MenuUI()
 {
     MenuHUD.SetActive(!MenuHUD.activeSelf);
     Cursor.visible = MenuHUD.activeSelf;
     GunHUD.SetActive(false);
 }
Example #6
0
        public HUD(Hero hero, Entity enemy, Fight fight)
        {
            this.topLeftFrame     = new Vector2(45, 35);
            this.topRightFrame    = new Vector2(445, 35);
            this.bottomLeftFrame  = new Vector2(25, 555);
            this.bottomRightFrame = new Vector2(735, 555);

            this.hero  = hero;
            this.enemy = enemy;

            this.enemyHit = false;
            this.heroHit  = false;

            enemyHitDelay = 0;
            heroHitDelay  = 0;

            this.heroInventory = new InventoryGUI(this.hero, fight);

            this.combatLog = new List <string>();
            this.logPos    = new Vector2(this.topRightFrame.X + 15, this.topRightFrame.Y + 10);

            #region Initialize HP/Mana Bars

            this.heroHpPercentage = (int)((float)this.hero.CurrentHealth / (float)this.hero.MaxHealth * 100.0);

            this.heroHp.Width  = this.heroHpPercentage * 2;
            this.heroHp.Height = 25;
            this.heroHp.X      = Convert.ToInt32(bottomLeftFrame.X + 15);
            this.heroHp.Y      = Convert.ToInt32(bottomLeftFrame.Y + 55);

            this.heroManaPercentage = (int)((float)this.hero.CurrentMana / (float)this.hero.MaxMana * 100.0);

            this.heroMana.Width  = this.heroManaPercentage * 2;
            this.heroMana.Height = 25;
            this.heroMana.X      = Convert.ToInt32(bottomLeftFrame.X + 15);
            this.heroMana.Y      = Convert.ToInt32(bottomLeftFrame.Y + 85);

            this.enemyHpPercentage = (int)((float)this.enemy.CurrentHealth / (float)this.enemy.MaxHealth * 100.0);

            this.enemyHp.Width  = this.enemyHpPercentage * 2;
            this.enemyHp.Height = 25;
            this.enemyHp.X      = Convert.ToInt32(bottomRightFrame.X + 15);
            this.enemyHp.Y      = Convert.ToInt32(bottomRightFrame.Y + 55);

            this.enemyManaPercentage = (int)((float)this.enemy.CurrentMana / (float)this.enemy.MaxMana * 100.0);

            this.enemyMana.Width  = this.enemyManaPercentage * 2;
            this.enemyMana.Height = 25;
            this.enemyMana.X      = Convert.ToInt32(bottomRightFrame.X + 15);
            this.enemyMana.Y      = Convert.ToInt32(bottomRightFrame.Y + 85);

            #endregion

            choiceHUD   = ChoiceHUD.Blank;
            menuHUD     = MenuHUD.Main;
            spellChoice = SpellChoice.Blank;

            #region Initialize Button Position

            this.button1 = new Vector2(topLeftFrame.X + 15, topLeftFrame.Y + 80);
            this.button2 = new Vector2(topLeftFrame.X + 210, topLeftFrame.Y + 80);
            this.button3 = new Vector2(topLeftFrame.X + 15, topLeftFrame.Y + 125);
            this.button4 = new Vector2(topLeftFrame.X + 210, topLeftFrame.Y + 125);

            this.buttonN = new Vector2(this.topLeftFrame.X + 190, this.topLeftFrame.Y + 15);
            this.buttonP = new Vector2(this.topLeftFrame.X + 115, this.topLeftFrame.Y + 15);

            #endregion
        }
Example #7
0
        public void Update(MouseInput mouseInput, KeyboardInput keyboardInput)
        {
            #region Update HP/Mana Bars

            this.heroHpPercentage    = (int)((float)this.hero.CurrentHealth / (float)this.hero.MaxHealth * 100.0);
            this.heroManaPercentage  = (int)((float)this.hero.CurrentMana / (float)this.hero.MaxMana * 100.0);
            this.enemyHpPercentage   = (int)((float)this.enemy.CurrentHealth / (float)this.enemy.MaxHealth * 100.0);
            this.enemyManaPercentage = (int)((float)this.enemy.CurrentMana / (float)this.enemy.MaxMana * 100.0);

            this.heroHp.Width    = this.heroHpPercentage * 2;
            this.heroMana.Width  = this.heroManaPercentage * 2;
            this.enemyHp.Width   = this.enemyHpPercentage * 2;
            this.enemyMana.Width = this.enemyManaPercentage * 2;

            #endregion

            #region Update HUD Choice

            if (menuHUD == MenuHUD.Main)
            {
                if (attackRect.Contains((int)mouseInput.Pos.X, (int)mouseInput.Pos.Y))
                {
                    choiceHUD = ChoiceHUD.Attack;
                }
                else if (defendRect.Contains((int)mouseInput.Pos.X, (int)mouseInput.Pos.Y))
                {
                    choiceHUD = ChoiceHUD.Defend;
                }
                else if (spellsRect.Contains((int)mouseInput.Pos.X, (int)mouseInput.Pos.Y))
                {
                    choiceHUD = ChoiceHUD.Spells;
                }
                else if (inventoryRect.Contains((int)mouseInput.Pos.X, (int)mouseInput.Pos.Y))
                {
                    choiceHUD = ChoiceHUD.Inventory;
                }
                else
                {
                    choiceHUD = ChoiceHUD.Blank;
                }
            }
            else if (menuHUD == MenuHUD.Spells)
            {
                if (nextRect.Contains((int)mouseInput.Pos.X, (int)mouseInput.Pos.Y))
                {
                    choiceHUD = ChoiceHUD.Next;
                }
                else if (prevRect.Contains((int)mouseInput.Pos.X, (int)mouseInput.Pos.Y))
                {
                    choiceHUD = ChoiceHUD.Previous;
                }
                else if (arcaneShockRect.Contains((int)mouseInput.Pos.X, (int)mouseInput.Pos.Y))
                {
                    spellChoice = SpellChoice.ArcaneShock;
                }
                else if (selfCureRect.Contains((int)mouseInput.Pos.X, (int)mouseInput.Pos.Y))
                {
                    spellChoice = SpellChoice.SelfCure;
                }
                else
                {
                    spellChoice = SpellChoice.Blank;
                    choiceHUD   = ChoiceHUD.Blank;
                }

                if (mouseInput.IsRightClicked())
                {
                    menuHUD = MenuHUD.Main;
                }
            }

            else if (menuHUD == MenuHUD.Inventory)
            {
                if (mouseInput.IsRightClicked())
                {
                    menuHUD = MenuHUD.Main;
                }
            }

            #endregion

            #region Hit Animation Timer

            if (this.enemyHit)
            {
                enemyHitDelay++;

                if (enemyHitDelay > 20)
                {
                    this.enemyHitDelay = 0;
                    this.enemyHit      = false;
                }
            }

            if (this.heroHit)
            {
                heroHitDelay++;

                if (heroHitDelay > 20)
                {
                    this.heroHitDelay = 0;
                    this.heroHit      = false;
                }
            }

            #endregion

            this.heroInventory.Update(mouseInput, keyboardInput);
        }