public HUD()
        {
            //Font
            PFC = new PrivateFontCollection();
            PFC.AddFontFile(@"kenyan_coffee_rg.ttf");
            _ownFontClock = new Font(PFC.Families[0], 32);
            _ownFontText  = new Font(PFC.Families[0], 32);

            //Proximity information
            _rectProximityInfo       = new EasyDraw(1920, 1080, addCollider: false);
            _rectProximityInfo.alpha = 0.9f;
            _rectProximityInfo.color = 0x262626;
            AddChild(_rectProximityInfo);

            _proximityInfo       = new EasyDraw(1920, 1080, addCollider: false);
            _proximityInfo.color = 0x56b25d;
            _proximityInfo.TextFont(_ownFontText);

            _textOnceAdded = false;

            //Clock Background
            _clockBackground = new Sprite("timeBackground.png");
            _clockBackground.SetXY(5, 15);
            AddChild(_clockBackground);

            //Clock
            _clock       = new EasyDraw(1920, 1080, addCollider: false);
            _clock.color = 0x56b25d;
            _clock.TextFont(_ownFontClock);
            AddChild(_clock);

            //Shopping list
            _shoppingList       = new Sprite("List.png");
            _shoppingList.scale = 0.65f;
            _shoppingList.SetXY(_shoppingList.width / 2.5f, 300);
            _shoppingList.SetOrigin(_shoppingList.width / 2, _shoppingList.height / 2);
            AddChild(_shoppingList);

            //Settings button
            _settingsButton = new Sprite("settingsButton.png");
            _settingsButton.SetXY(225, 13);
            AddChild(_settingsButton);

            //Chatbox
            _chatBox = new Sprite("chatBox.png");
            _chatBox.SetOrigin(_chatBox.width / 2, _chatBox.height / 2);
            _chatBox.SetXY(game.width / 2, game.height - 50);
            AddChild(_chatBox);

            //Sound
            _backgroundMusic     = new Sound("backgroundSounds.mp3", true, true);
            _backgroundSC        = _backgroundMusic.Play();
            _backgroundSC.Volume = 0.35f;

            //Tutorial
            tutorial = new Sprite("Tutorial.png");
            tutorial.SetOrigin(tutorial.width / 2, tutorial.height / 2);
            tutorial.SetXY(game.width / 2, game.height / 2);
            AddChild(tutorial);
        }
示例#2
0
        private void makeIconsForFish(int i, int j, Fish fish)
        {
            Sprite fishIcon = new Sprite(fish.fishName + "-icon.png");

            AddChild(fishIcon);
            fishIcon.SetOrigin(fishIcon.width / 2, fishIcon.height / 2);
            fishIcon.width  /= 8;
            fishIcon.height /= 8;
            fishIcon.x       = i * game.width / 4;
            fishIcon.y       = j * game.height / 3 - fishIcon.height / 2;
        }
示例#3
0
        public LevelEndScreen() : base("data/Next level screen.png")
        {
            _nextLevelSprite = new Sprite("data/Next Level Text.png", true, false);
            AddChild(_nextLevelSprite);
            _nextLevelSprite.SetXY(1225, 743);
            _nextLevelSprite.SetOrigin(_nextLevelSprite.width * 0.5f, _nextLevelSprite.height * 0.5f);

            //Wait some time to enable input
            CoroutineManager.StartCoroutine(WaitSomeTime(), this);

            //Animate Text
            SpriteTweener.TweenScalePingPong(_nextLevelSprite, 1, 1.05f, 300);
        }
示例#4
0
        public Scene(string path, CurrencySystem currency, Level level, int scene, int price = 400, Tutorial tutorial = null) : base()
        {
            //  _tutorial = tutorial;

            this.scene  = scene;
            _currency   = currency;
            visible     = false;
            this.level  = level;
            isActive    = false;
            canMakeFood = true;
            tank        = new Sprite(path);
            downArrow   = new Sprite("downarrow.png");

            downArrow.SetXY(game.width / 2, game.height - 200);
            downArrow.SetScaleXY(0.2f);
            foodList = new List <Food>();
            AddChildAt(tank, 0);
            AddChild(downArrow);
            priceOfAquarium = price;

            fishListPerScene = new List <Fish>();
            DisplayFishInScene fishes = new DisplayFishInScene(scene, foodList, fishListPerScene);

            sponge            = new Sponge(this);
            shop              = new Shop(fishListPerScene, level);
            inv               = new Inventory();
            clickToBuy        = new Sprite("checkers.png");
            clickToBuy.width  = 200;
            clickToBuy.height = 200;
            clickToBuy.y     += 300;
            AddChild(clickToBuy);
            foodCan = new Sprite("fish_food.png");
            foodCan.SetOrigin(foodCan.width / 4, 0);
            foodCan.width  /= 5;
            foodCan.height /= 5;
            for (int i = 0; i < 30; i++)
            {
                Dirt dirt = new Dirt(ref cleanMeter);
                sponge.addDirt(dirt);
                AddChild(dirt);
            }
            AddChild(shop);
            shop.visible        = false;
            cleanDirtWithSponge = new Sound("sponge_use_sound.wav", true, true);
            //spongeClean = cleanDirtWithSponge.Play();
            //spongeClean.Stop();
            repairAquarium = new Sound("repair_aquarium_sound.wav", false, true);
            makeFoodSound  = new Sound("fish_food_pick_sound.wav", false, true);
            openShop       = new Sound("opening_journal_shop_sound.wav", false, true);
            // openShopSoundChannel = openShop.Play();
        }
        public HiddenRoomCoverManager(BaseLevel pLevel) : base(false)
        {
            Instance = this;
            _level   = pLevel;

            //Load hidden room from tmx
            var map = _level.LevelMap.MapData;

            var hiddenRoomData = map.ObjectGroups?.Where(og => og.Name == "Hidden Room Cover").FirstOrDefault()?.Objects
                                 .FirstOrDefault(ob => ob.Name == "Hidden Room Cover");

            var hiddenRoomColliderData = map.ObjectGroups?.Where(og => og.Name == "Hidden Room Cover").FirstOrDefault()
                                         ?.Objects
                                         .FirstOrDefault(ob => ob.Name == "Hidden Room Collider");

            if (hiddenRoomData == null || hiddenRoomColliderData == null)
            {
                Console.WriteLine(
                    $"ERROR: Hidden Room Cover or Collider Tmx objects not found in Hidden Room Cover object layer");
            }
            else
            {
                _hiddenRoomCover = new Sprite("data/Hidden Room Cover.png", false, false);

                _hiddenRoomCover.width  = Mathf.Round(hiddenRoomData.Width);
                _hiddenRoomCover.height = Mathf.Round(hiddenRoomData.Height);
                _hiddenRoomCover.SetOrigin(0, _hiddenRoomCover.texture.height);

                _level.AddChild(_hiddenRoomCover);
                _hiddenRoomCover.rotation = hiddenRoomData.rotation;
                _hiddenRoomCover.SetXY(hiddenRoomData.X, hiddenRoomData.Y);

                _hiddenRoomCoverCollider = new Sprite("data/White Texture.png");

                _hiddenRoomCoverCollider.width  = Mathf.Round(hiddenRoomColliderData.Width);
                _hiddenRoomCoverCollider.height = Mathf.Round(hiddenRoomColliderData.Height);
                _hiddenRoomCoverCollider.SetOrigin(0, _hiddenRoomCoverCollider.texture.height);

                _level.AddChild(_hiddenRoomCoverCollider);
                _hiddenRoomCoverCollider.rotation = hiddenRoomColliderData.rotation;
                _hiddenRoomCoverCollider.SetXY(hiddenRoomColliderData.X, hiddenRoomColliderData.Y);
                _hiddenRoomCoverCollider.visible = false;

                Console.WriteLine(
                    $"{_hiddenRoomCoverCollider}: {_hiddenRoomCoverCollider.scaleX} | {_hiddenRoomCoverCollider.scaleY}");

                CoroutineManager.StartCoroutine(Start(), this);
            }
        }
示例#6
0
        public StartScreen() : base("data/Startscreen Bg.png")
        {
            //1260 207

            _startText = new Sprite("data/Start Screen - pressstart.png", true, false);
            AddChild(_startText);
            _startText.SetOrigin(_startText.width * 0.5f, _startText.height * 0.5f);
            _startText.SetXY(1260, 207);


            float mScale = _startText.scale;

            SpriteTweener.TweenScalePingPong(_startText, mScale, mScale * 1.02f, 300);

            SoundManager.Instance.PlayMusic(0);
        }
示例#7
0
        public MeatStand(float givenX, float givenY, float givenRotation) : base(givenX, givenY, "MeatStand.png", givenRotation)
        {
            _buyMenu    = new Sprite("buyScreen.png");
            _buyMenu2   = new Sprite("buyScreen2.png");
            _exitButton = new Sprite("exitCross.png");
            _buyMenu.SetOrigin(_buyMenu.width / 2, _buyMenu.height / 2);
            _buyMenu.SetXY(game.width - _buyMenu.width + 150, game.height - _buyMenu.height + 150);
            _buyMenu2.SetOrigin(_buyMenu.width / 2, _buyMenu.height / 2);
            _buyMenu2.SetXY(game.width - _buyMenu.width + 150, game.height - _buyMenu.height + 150);
            _exitButton.SetXY(_buyMenu.x + 500, _buyMenu.y - 325);
            _menuShown = false;
            scale      = 0.85f;

            _boughtItem = new EasyDraw(1920, 1080);
            _boughtItem.TextSize(16);
            _boughtItem.SetColor(0, 0, 0);
        }
示例#8
0
        public Debree(float x, float y, float _xTarg, float _yTarg, float beatMs, string texturePath) : base(100, 100)
        {
            note = new Sprite(texturePath, false);
            note.SetOrigin(note.width / 2, note.height / 2);
            note.scale = .2f;
            AddChild(note);
            this.x       = x;
            this.y       = y;
            this._beatMs = beatMs;

            SetOrigin(width / 2, height / 2);
            Ellipse(width / 2, height / 2, 20, 20);

            _distance = Extensions.GetDistance(_xTarg, _yTarg, x, y);
            _xSpeed   = (_xTarg - x) / _distance;           //Its more like a speed multiplier, this one should be 1 and
            _ySpeed   = (_yTarg - y) / _distance;           //the y one should be a multiplier of some sorts
        }
示例#9
0
        public LevelSelect()
            : base()
        {
            //Set the menu background
            Sprite background = new Sprite ("Sprites/bg.png");
            AddChild (background);

            //render the game logo
            Sprite logo = new Sprite ("Sprites/logo.png");
            logo.SetOrigin ((logo.width / 2), (logo.height / 2));
            logo.SetXY (244, 130);
            AddChild (logo);

            //list of the level names
            _levelList = new LevelLister ();

            //list of level buttons
            _levelButtons = new List<DrawString> ();

            Console.WriteLine ("LevelSelect");

            //add the menubuttons to the list
            int i = 275;
            foreach (string levelName in _levelList.GetLevels()) {
                _levelButtons.Add (new DrawString (levelName, 244, i, _font, _defaultColor));
                i += 60;
            }

            //add menu buttons to an array
            _levelButtonsArray = _levelButtons.ToArray ();
            for (int k = 0; k < _levelButtonsArray.Length; k++) {
                AddChild (_levelButtonsArray [k]);
            }

            //draw the back button
            _backButton = new DrawString ("Back", 244, 615, _font, _defaultColor);
            AddChild (_backButton);
        }
示例#10
0
文件: Endscreen.cs 项目: mbos14/GTFO
        private void drawScreen()
        {
            //Background
            AnimationSprite background = new AnimationSprite("endscreenbg.png", 1, 2);
            AddChild(background);

            //Draw credits
            _credits = new Sprite("credits.png");
            AddChild(_credits);
            _credits.y = game.height;

            //Draw borders
            Sprite borders = new Sprite("endscreenborders.png");
            AddChild(borders);

            //Draw YOUWON or YOULOST
            AnimationSprite wonlost = new AnimationSprite("wonlost.png", 1, 2);
            wonlost.SetOrigin(wonlost.width / 2, wonlost.height / 2);
            wonlost.SetXY(_game.width / 2, 100);
            AddChild(wonlost);

            //Check if player has won or lost
            if (CurrentWonTest == LevelTest.Won)
            {
                background.SetFrame((int)CurrentWonTest);
                wonlost.SetFrame((int)CurrentWonTest);
            }
            else if (CurrentWonTest == LevelTest.Lost)
            {
                background.SetFrame((int)CurrentWonTest);
                wonlost.SetFrame((int)CurrentWonTest);
            }

            //Draw "Throw in a coin to play again"
            _insertcoin = new Sprite("insertcoin.png");
            AddChild(_insertcoin);
            _insertcoin.SetOrigin(_insertcoin.width / 2, _insertcoin.height / 2);
            _insertcoin.SetXY(game.width / 2, game.height - _insertcoin.height);
        }