Esempio n. 1
0
 void checkIfItemIsPressed()
 {
     foreach (Item item in listOfItemsInInventory)
     {
         if (MyGame.CheckMouseInRectClick(item))
         {
             if (item.selected == false)
             {
                 foreach (Item thing in listOfItemsInInventory)
                 {
                     if (thing != item)
                     {
                         thing.selected = false;
                     }
                     else
                     {
                         thing.selected = true;
                     }
                 }
                 id = item.id;
             }
             else
             {
                 item.selected = false;
                 id            = 0;
             }
         }
     }
 }
Esempio n. 2
0
 void Update()
 {
     if (MyGame.CheckMouseInRectClick(next))
     {
         NextFrame();
     }
 }
Esempio n. 3
0
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        //                                                                                                                        CreateCredits()
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        void CreateCredits()
        {
            DestroyStartMenu();

            MyGame mygame = game as MyGame;

            mygame.CreateControlsMenu();
        }
Esempio n. 4
0
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        //                                                                                                                        GoBackToStartMenu()
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        void GoBackToStartMenu()
        {
            DestroyControlsMenu();

            MyGame mygame = game as MyGame;

            mygame.CreateMenu();
        }
Esempio n. 5
0
        public ScorePage(double scoreNumber) : base(GetAssets.GetCorrectDeathPage(scoreNumber))
        {
            SetScaleXY(MyGame.OldX() / width, MyGame.OldY() / height);
            TextBox score = new TextBox(game.width, game.height, 0, 0);

            AddChild(score);
            score.SetText("your score: " + scoreNumber, MyGame.OldX() / 2.5f, MyGame.OldY() * 1.7f / 2.5f);
        }
Esempio n. 6
0
 /// <summary>
 /// Create a new MouseHandler for the given target.
 /// </summary>
 /// <param name="target">Target.</param>
 public MMouseHandler(GameObject target)
 {
     _target            = target;
     _game              = (MyGame)_target.game;
     _game.OnAfterStep += HandleOnStep;
     _lastX             = Input.mouseX;
     _lastY             = Input.mouseY;
 }
Esempio n. 7
0
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        //                                                                                                                        GoBackToStartMenu()
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        void GoBackToVictoryMenu()
        {
            DestroyCreditsMenu();

            MyGame mygame = game as MyGame;

            mygame.CreateVictoryScreen();
        }
Esempio n. 8
0
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        //                                                                                                                        CreateGame()
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        void CreateGame()
        {
            DestroyStartMenu();

            MyGame mygame = game as MyGame;

            mygame.CreateLevel1();
            mygame.startMusic();
        }
Esempio n. 9
0
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        //                                                                                                                        GoBackToStartMenu()
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        void GoBackToStartMenu()
        {
            DestroyVictoryScreen();

            MyGame mygame = game as MyGame;

            mygame.ResetWholeGame();
            mygame.CreateMenu();
        }
Esempio n. 10
0
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        //                                                                                                                        CreateCreditsMenu()
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        void CreateCreditsMenu()
        {
            DestroyVictoryScreen();

            MyGame mygame = game as MyGame;

            mygame.ResetWholeGame();
            mygame.CreateCreditsMenu();
        }
Esempio n. 11
0
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        //                                                                                                                        GoBackToStartMenu()
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        void GoBackToStartMenu()
        {
            DestroyGameOver();

            MyGame mygame = game as MyGame;

            mygame.ResetWholeGame();
            mygame.CreateMenu();
        }
Esempio n. 12
0
 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 //                                                                                                                        CheckForNewLevel()
 //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 void CheckForNewLevel()
 {
     if (player.x >= 13500)
     {
         MyGame mygame = game as MyGame;
         LateDestroy();
         LateRemove();
         mygame.CreateBossLevel();
     }
 }
Esempio n. 13
0
 public bool checkIfItemIsOverlapped()
 {
     foreach (Item item in listOfItemsInInventory)
     {
         if (MyGame.CheckMouseInRect(item))
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 14
0
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        //                                                                                                                        HandleGameOver()
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        void HandleGameOver()
        {
            if (Globals.health_player == 0 && Globals.playerIsDead == false)
            {
                Globals.playerIsDead = true;

                MyGame mygame = game as MyGame;
                mygame.GameOver();

                _deathSound.Play();
            }
        }
Esempio n. 15
0
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        //                                                                                                                        RestartGame()
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        void RestartGame()
        {
            DestroyVictoryScreen();

            MyGame mygame = game as MyGame;

            mygame.ResetWholeGame();
            mygame.CreateLevel1();
            mygame.startMusic();

            Globals.bossIsDead = false;
        }
Esempio n. 16
0
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        //                                                                                                                        RestartLevel()
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        void RestartLevel()
        {
            DestroyGameOver();

            MyGame mygame = game as MyGame;

            mygame.ResetWholeGame();
            mygame.CreateLevel1();
            mygame.startMusic();

            Globals.bossIsDead = false;
        }
Esempio n. 17
0
 void goBack()
 {
     if (MyGame.CheckMouseInRectClick(downArrow))
     {
         isActive        = false;
         level.isInScene = false;
         visible         = false;
         if (HasChild(shop))
         {
             RemoveChild(shop);
         }
         // makeTutorialDissapear();
     }
 }
Esempio n. 18
0
        public Level(MyGame mygame, int width, int height) : base()
        {
            _mygame = mygame;
            this.x  = 0;
            this.y  = 0;

            _screenHeight = height;
            _screenWidth  = width;

            _lvl = this;

            _backgroundChanel        = _backgroundMusic.Play();
            _backgroundChanel.Volume = 0.3f;
        }
Esempio n. 19
0
        public void OnCollision(GameObject other)

        {
            if (other is Enemy)
            {
                Enemy enemy = other as Enemy;
                enemy.Destroy();
                MyGame myGame = game as MyGame;
                myGame.AddScore();
            }
            else if (other is Crate)
            {
                Destroy();
            }
        }
Esempio n. 20
0
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        //                                                                                                                        HandleDeath()
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        void HandleDeath()
        {
            if (Globals.health_boss == 0 && Globals.bossIsDead == false)
            {
                Globals.bossIsDead = true;

                MyGame mygame = game as MyGame;
                mygame.CreateVictoryScreen();

                if (Globals.bossDeathSoundHasPlayed == false)
                {
                    _deathSound.Play();
                    Globals.bossDeathSoundHasPlayed = true;
                }
            }
        }
Esempio n. 21
0
        public InfoScreen(MyGame mygame) : base("HUD/info page (1).png")
        {
            _backgroundChanel        = _backgroundMusic.Play();
            _backgroundChanel.Volume = 0.5f;

            _mygame     = mygame;
            this.width  = game.width;
            this.height = game.height;

            _startButton.x = _width * 0.6f;
            _startButton.y = _height * 0.99f;

            _quitButton.x = _width * 0.8f;
            _quitButton.y = _height * 0.99f;

            AddChild(_startButton);
            AddChild(_quitButton);
        }
Esempio n. 22
0
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        //                                                                                                                        HandleBorders()
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        void HandleBorders()
        {
            MyGame mygame = game as MyGame;

            if (mygame.level1IsActive == true || mygame.level2IsActive == true)
            {
                x = Mathf.Clamp(x, 700, 13700);
            }

            if (Globals.levelBossIsActive == true)
            {
                x = Mathf.Clamp(x, (0 + width / 2), (1440 - width / 2));
            }

            y = Mathf.Clamp(y, (0), (830));

            if (y >= (830))
            {
                isLanded = true;
            }
        }
Esempio n. 23
0
        //void makeTutorialDissapear()
        //{
        //    if (_tutorial != null)
        //    {
        //        _tutorial.BecomeInvisible();
        //    }
        //}
        //void makeTutorialAppear()
        //{
        //    if (_tutorial != null)
        //    {
        //        _tutorial.BecomeVisible();
        //      //  _tutorial.maxFrameToChange++;
        //    }
        //}
        //void ChangeTutorialMaxFrame()
        //{
        //    if (_tutorial != null)
        //    {
        //        _tutorial.maxFrameToChange=tutorialIndex;
        //    }
        //}
        //void ChangeTutorialFrame()
        //{
        //    if (_tutorial != null)
        //    {
        //        _tutorial.currentFrame++;
        //    }
        //}

        void buyAquarium()
        {
            //Console.WriteLine(_tutorial.visible);
            if (MyGame.CheckMouseInRectClick(clickToBuy))
            {
                if (level.currencySystem.money >= priceOfAquarium)
                {
                    clickToBuy.LateDestroy();
                    isBought = true;
                    AddChild(inv);
                    level.currencySystem.RemoveMoney(priceOfAquarium);
                    repairAquarium.Play();
                    //if (_tutorial.visible == true)
                    //{
                    //    ChangeTutorialFrame();
                    //}

                    //tutorialIndex += 1;
                    //ChangeTutorialMaxFrame();
                }
            }
        }
Esempio n. 24
0
 void Update()
 {
     if (visible == true)
     {
         foreach (Fish fish in fishList)
         {
             if (MyGame.CheckMouseInRectClick(fish.buyToUnlock))
             {
                 if (_level.currencySystem.money >= fish.coinValue)
                 {
                     if (fish.isUnlocked == false)
                     {
                         buyFish.Play();
                         _level.currencySystem.RemoveMoney(fish.coinValue);
                         fish.Unlock();
                         _level.journal.AddFish(fish);
                     }
                 }
             }
         }
     }
 }
Esempio n. 25
0
        public void CreateWave(int pCurrentLevel, int pCurrentColumn)
        {
            if (pCurrentLevel == 1)
            {
                levelDataPointer = level1;

                int tile = levelDataPointer[pCurrentColumn];
                if (pCurrentColumn < levelDataPointer.GetLength(0))
                {
                    Enemy enemy = new Enemy(1000, 300);
                    AddChild(enemy);
                }

                if (pCurrentColumn == levelDataPointer.GetLength(0) - 1)
                {
                    MyGame myGame = game as MyGame;
                    myGame.EndOfWave();
                }
            }

            if (pCurrentLevel == 2)
            {
                levelDataPointer = level2;

                int tile = levelDataPointer[pCurrentColumn];
                if (pCurrentColumn < levelDataPointer.GetLength(0))
                {
                    Enemy enemy = new Enemy(1000, 300);
                    AddChild(enemy);
                }

                if (pCurrentColumn == levelDataPointer.GetLength(0) - 1)
                {
                    MyGame myGame = game as MyGame;
                    myGame.EndOfWave();
                }
            }
        }
Esempio n. 26
0
        public MainMenu(MyGame mygame) : base("HUD/menu.png")
        {
            _backgroundChanel        = _backgroundMusic.Play();
            _backgroundChanel.Volume = 0.5f;

            _mygame = mygame;

            this.width  = game.width;
            this.height = game.height;

            _startButton.x = game.width * 0.35f;
            _startButton.y = game.height * 0.75f;

            _infoButton.x = game.width * 0.55f;
            _infoButton.y = game.height * 0.75f;

            _quitButton.x = game.width * 0.75f;
            _quitButton.y = game.height * 0.75f;

            AddChild(_startButton);
            AddChild(_infoButton);
            AddChild(_quitButton);
        }
Esempio n. 27
0
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        //                                                                                                                        HandleClickButton()
        //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        void HandleClickButton()
        {
            if (Input.GetMouseButtonUp(0))
            {
                if (_start_button.HitTestPoint(Input.mouseX, Input.mouseY))
                {
                    CreateGame();
                }

                if (_credits_button.HitTestPoint(Input.mouseX, Input.mouseY))
                {
                    CreateCredits();
                }

                if (_quit_button.HitTestPoint(Input.mouseX, Input.mouseY))
                {
                    MyGame mygame = game as MyGame;
                    mygame.quitIsPressed = true;

                    MyGame.timeSince = Time.now;
                }
            }
        }
Esempio n. 28
0
        void Update()
        {
            canvas.graphics.Clear(Color.Transparent);
            if (isVisible)
            {
                canvas.graphics.DrawString(text, font, Brushes.Black, canvas.width / 2 - 200, 20);
                if (MyGame.CheckMouseInRectClick(skip) && HasChild(skip))
                {
                    isVisible = false;
                    level.SetInTutorial(false);
                    parent.RemoveChild(this);
                }
                if (MyGame.CheckMouseInRectClick(next) && HasChild(next))
                {
                    count++;
                    if (count > 10)
                    {
                        isVisible = false;
                        level.SetInTutorial(false);
                        parent.RemoveChild(this);
                    }
                }

                switch (count)
                {
                case 0:
                    text = "Hello and welcome to your\nnew aquarium. This is the\nmain hub. From here you\ncan see all " +
                           "of your aquariums\nand you can also repair them\nto get access to new\ntypes of fish.";
                    break;

                case 1:
                    text = "First you need to buy\nyour first aquarium.\nThankfully, you have enough\nmoney to do so. Click on\nthe aquarium to the left\nto enter it.";
                    RemoveChild(next);
                    break;

                case 2:
                    text = "Good Job! This is the\nfirst aquarium. Later you\nwill be able to look at\nyour fishes here. Click on\nthe sign to purchase your\nfirst aquarium.";
                    break;

                case 3:
                    text = "Congratulations on your\nnew Aquarium. But it seems\na little dirty. Click on\nthe sponge on the right and\nuse it to wipe the stains\nfrom the glass.Beware as\nstains could be behind\nthis tutorial";
                    break;

                case 4:
                    text = "Perfect. Now you just\nneed a fish and you will get the\naquarium fully working. To buy\nfish you need to click\non the shop icon\nto the right.";
                    break;

                case 5:
                    text = "This is the shop. Here you\ncan buy new fish. The choice\nof fish depends on the type\nof aquarium you're in.";
                    AddChild(next);
                    break;

                case 6:
                    RemoveChild(next);
                    text = "Now use the rest of\nyour money to buy the\nEuropean Perch by clicking\non the buy button.";
                    break;

                case 7:
                    text = "Good job, you bought your\nfirst fish! Fish create\ndirt and need to be fed\nfrom time to time. Click on\nthe close button to proceed.";
                    break;

                case 8:
                    text = "You can see that the fish\nhas a bubble next to it. That\nmeans that the fish\nis hungry. To feed\nhim, click on the food\ncontainer to the right and\nclick anywhere in the level\nto spread some fish food";
                    RemoveChild(next);
                    break;

                case 9:
                    text = "As you can see the\nfish goes towards the food\nand will produce a coin.\nFish only produce coins when\nthey" +
                           "are fed and the\naquarium is clean. Coins can\nbe used to buy more\nfish and aquariums.";
                    AddChild(next);
                    break;

                case 10:
                    text = "One last thing before\nyou go. The journal on the\n right includes \ninformation to all fish\nyou collect. Now go\nand have fun!";
                    break;
                }
            }
        }