Ejemplo n.º 1
0
        public void TowerButtom(GuiImagePanel _buttonImagePanel, int _rowNumber, string _face, PickTowerType _pickTower, Tower _tower)
        {
            TowerButton_GUI guiButton = new TowerButton_GUI(
                // Texture2D
                SpriteContainer.sprite[_face],
                // Position
                new Vector2(50 + _rowNumber * 100, -100),
                // Scale
                new Vector2(0.3f, 0.3f),
                // Layer Depth
                0.9f,
                // Origin
                OriginPositionEnum.TopLeft
                );

            guiButton.ParentGUI           = _buttonImagePanel;
            guiButton.Tower               = _tower;
            guiButton.Transform.Position += _buttonImagePanel.Transform.Position;
            guiButton.Color               = Color.White;
            guiButton.IsHoveringColor     = Color.Green;
            guiButton.OnClick             = () => { setTowers.SetTowerType(_pickTower); };
            Instantiate(guiButton);
            TowerCost(
                guiButton.Transform.Position + new Vector2(35, 80),
                guiButton.Tower.TowerCost.ToString()
                );
        }
Ejemplo n.º 2
0
        public void MakeWorldEditorUI()
        {
            #region Button Panel
            // Button Image Panel
            GuiImagePanel buttonImagePanel = new GuiImagePanel(
                // Texture2D
                SpriteContainer.sprite["Pixel"],
                // Position
                new Vector2(0, GraphicsSetting.ScreenSize.Y),
                // Scale
                new Vector2(GraphicsSetting.ScreenSize.X, 100),
                // Layer Depth
                0.5f,
                // Origin
                OriginPositionEnum.BottomLeft
                );
            Instantiate(buttonImagePanel);
            #endregion

            #region Tile
            // Made Tile
            for (int i = 0; i < 4; i++)
            {
                GuiButton guiButton = new GuiButton(
                    // Texture2D
                    SpriteContainer.sprite["Pixel"],
                    // Position
                    new Vector2(50 + i * 100, -85),
                    // Scale
                    new Vector2(70, 70),
                    // Layer Depth
                    0.9f,
                    // Origin
                    OriginPositionEnum.TopLeft
                    );

                guiButton.ParentGUI           = buttonImagePanel;
                guiButton.Transform.Position += buttonImagePanel.Transform.Position;
                guiButton.Color           = Color.Blue;
                guiButton.IsHoveringColor = Color.Red;

                Instantiate(guiButton);
            }
            #endregion
        }
Ejemplo n.º 3
0
        public void TowerCost(Vector2 _position, string moneyCost)
        {
            // Show Currency Image
            GuiImagePanel showCurrencyImage = new GuiImagePanel(
                // Texture2D
                SpriteContainer.sprite["coin"],
                // Position
                new Vector2(_position.X, _position.Y),
                // Scale
                new Vector2(0.6f, 0.6f),
                // Layer Depth
                0.95f,
                // Origin
                OriginPositionEnum.TopRight
                );

            Instantiate(showCurrencyImage);

            // Show Currency Text
            showCurrencyText = new GuiText(
                // SpriteFont
                SpriteContainer.normalFont,
                // Texture2D
                moneyCost,
                // Position
                new Vector2(
                    5,
                    0
                    ),
                // Scale
                new Vector2(0.4f, 0.4f),
                // Layer Depth
                0.95f,
                // Origin
                OriginPositionEnum.TopLeft
                );
            showCurrencyText.ParentGUI           = showCurrencyImage;
            showCurrencyText.Transform.Position += showCurrencyText.ParentGUI.Transform.Position;
            Instantiate(showCurrencyText);
        }
Ejemplo n.º 4
0
        public void MakeGameGui()
        {
            #region Button Panel
            // Button Image Panel
            GuiImagePanel buttonImagePanel = new GuiImagePanel(
                // Texture2D
                SpriteContainer.sprite["Pixel"],
                // Position
                new Vector2(0, GraphicsSetting.ScreenSize.Y),
                // Scale
                new Vector2(GraphicsSetting.ScreenSize.X, 100),
                // Layer Depth
                0.5f,
                // Origin
                OriginPositionEnum.BottomLeft
                );
            buttonImagePanel.Color = Color.DimGray;
            Instantiate(buttonImagePanel);
            #endregion

            #region Tower buttons
            // Made Tower Button's
            TowerButtom(buttonImagePanel, 0, "Face_Dennis", PickTowerType.Dennis, new Dennis_Tower(5));
            TowerButtom(buttonImagePanel, 1, "Face_Jonathan", PickTowerType.Jonathan, new Jonathan_Tower(10));
            TowerButtom(buttonImagePanel, 2, "Face_Kennet", PickTowerType.Kenneth, new Kenneth_Tower(15));
            TowerButtom(buttonImagePanel, 3, "Face_Mikae", PickTowerType.Mikael, new Mikael_Tower(20));
            TowerButtom(buttonImagePanel, 4, "Face_Milo", PickTowerType.Milo, new Milo_Tower(25));
            #endregion

            #region Show Currency
            // Show Currency Image
            GuiImagePanel showCurrencyImage = new GuiImagePanel(
                // Texture2D
                SpriteContainer.sprite["coin"],
                // Position
                new Vector2(GraphicsSetting.ScreenSize.X - 75, 10),
                // Scale
                new Vector2(1, 1),
                // Layer Depth
                0.9f,
                // Origin
                OriginPositionEnum.TopRight
                );
            Instantiate(showCurrencyImage);

            // Show Currency Text
            showCurrencyText = new GuiText(
                // SpriteFont
                SpriteContainer.normalFont,
                // Texture2D
                "Money: ?",
                // Position
                new Vector2(5, 6),
                // Scale
                new Vector2(0.4f, 0.4f),
                // Layer Depth
                0.9f,
                // Origin
                OriginPositionEnum.MidRight
                );
            showCurrencyText.ParentGUI           = showCurrencyImage;
            showCurrencyText.Transform.Position += showCurrencyText.ParentGUI.Transform.Position;
            Instantiate(showCurrencyText);
            #endregion

            #region Show Life
            // Show Life Image
            GuiImagePanel showLifeImage = new GuiImagePanel(
                // Texture2D
                SpriteContainer.sprite["heart"],
                // Position
                new Vector2(50, 10),
                // Scale
                new Vector2(0.2f, 0.2f),
                // Layer Depth
                0.9f,
                // Origin
                OriginPositionEnum.TopRight
                );
            Instantiate(showLifeImage);

            // Show Life Text
            showLifeText = new GuiText(
                // SpriteFont
                SpriteContainer.normalFont,
                // Texture2D
                "Life: ?",
                // Position
                new Vector2(5, 7),
                // Scale
                new Vector2(0.4f, 0.4f),
                // Layer Depth
                0.9f,
                // Origin
                OriginPositionEnum.MidRight
                );
            showLifeText.ParentGUI           = showLifeImage;
            showLifeText.Transform.Position += showLifeText.ParentGUI.Transform.Position + new Vector2(showLifeText.ParentGUI.Transform.Scale.X, 0);
            Instantiate(showLifeText);
            #endregion

            #region Top Panel
            // Button Image Panel
            GuiImagePanel topImagePanel = new GuiImagePanel(
                // Texture2D
                SpriteContainer.sprite["Pixel"],
                // Position
                new Vector2(0, 0),
                // Scale
                new Vector2(GraphicsSetting.ScreenSize.X, 50),
                // Layer Depth
                0.5f,
                // Origin
                OriginPositionEnum.TopLeft
                );
            topImagePanel.Color = Color.Black;
            Instantiate(topImagePanel);
            #endregion

            UpdateLiveCoin();
        }
Ejemplo n.º 5
0
        public void MadeThis()
        {
            // - - - - - Show Currency Image
            imagePanel = new GuiImagePanel(
                // Texture2D
                SpriteContainer.sprite["Pixel"],
                // Position
                new Vector2(
                    GraphicsSetting.ScreenSize.X / 2 - 300,
                    GraphicsSetting.ScreenSize.Y - 550),
                // Scale
                new Vector2(600f, 350f),
                // Layer Depth
                0.999f,
                // Origin
                OriginPositionEnum.TopLeft
                );
            imagePanel.Color = Color.Black;
            Instantiate(imagePanel);

            string startText = "Move Camera With\n" +
                               "W A S D keys\n\n" +
                               "Left Click to set tower.\n" +
                               "You cant delete towers so be careful";

            // - - - - - Start Info text
            startInfoText = new GuiText(
                // SpriteFont
                SpriteContainer.normalFont,
                // Texture2D
                startText,
                // Position
                new Vector2(
                    imagePanel.Transform.Position.X + 10,
                    imagePanel.Transform.Position.Y + 10
                    ),
                // Scale
                new Vector2(0.6f, 0.6f),
                // Layer Depth
                0.9991f,
                // Origin
                OriginPositionEnum.TopLeft
                );
            startInfoText.Color     = Color.White;
            startInfoText.ParentGUI = imagePanel;
            Instantiate(startInfoText);

            // - - - - - Start Button
            guiButton = new GuiButton(
                // Texture2D
                SpriteContainer.sprite["Pixel"],
                // Position
                new Vector2(
                    imagePanel.Transform.Position.X + imagePanel.Transform.Scale.X / 2,
                    imagePanel.Transform.Position.Y + imagePanel.Transform.Scale.Y - 10
                    ),
                // Scale
                new Vector2(150, 50),
                // Layer Depth
                0.9991f,
                // Origin
                OriginPositionEnum.BottomMid,
                // Sprite font
                SpriteContainer.normalFont,
                // Button Text
                "Start Game",
                // Font Scale
                new Vector2(0.5f, 0.5f)
                );

            guiButton.ParentGUI = imagePanel;
            Instantiate(guiButton);

            guiButton.Color           = Color.White;
            guiButton.FontColor       = Color.Black;
            guiButton.IsHoveringColor = Color.Green;

            guiButton.OnClick = () => {
                myScene.PauseGame      = false;
                imagePanel.IsActive    = false;
                startInfoText.IsActive = false;
            };
        }