Esempio n. 1
0
        public void Initialize(Vector2?playerPosition = null)
        {
            this.UIs = new List <IUI>()
            {
                new Label(
                    rectangle: new Rectangle(260, 10, 230, 30),
                    spriteFont: WK.Font.font_7,
                    "PunchHole",
                    Label.TextAlignment.Midle_Center,
                    ""
                    ),
                new Button(
                    rectangle: new Rectangle(0, 470, 230, 30),
                    text: "<- Others",
                    defaultTexture: WK.Texture.LightGray,
                    mouseOverTexture: WK.Texture.Gray,
                    spriteFont: WK.Font.font_7,
                    tag: "goToOthers",
                    OnClickAction: () => Game1.ChangeToScene(WK.Scene.Others)
                    ),
            };

            this.entities = new List <IEntity>()
            {
                //new Light(new Point(30, 30)),
                new Player(new Point(100, 100))
            };



            Point[] points = entities.Select(x => x.rigidbody.centerPosition.ToPoint()).ToArray();
            UIs.Add(new Shadow(points));
        }
Esempio n. 2
0
        public void Initialize(Vector2?playerPosition = null)
        {
            this.UIs = new List <IUI>()
            {
                new Button(
                    rectangle: new Rectangle(0, 470, 230, 30),
                    text: "<- Entities",
                    defaultTexture: WK.Texture.LightGray,
                    mouseOverTexture: WK.Texture.Gray,
                    spriteFont: WK.Font.font_7,
                    tag: "goToEntities",
                    OnClickAction: () => Game1.ChangeToScene(WK.Scene.Entities)
                    ),
            };

            this.entities = new List <IEntity>()
            {
                new Line(
                    start: new Point(ChristianGame.Default.canvasWidth / 2, ChristianGame.Default.canvasHeight / 2),
                    end: new Point(ChristianGame.Default.canvasWidth / 2, ChristianGame.Default.canvasHeight / 2),
                    thickness: 5,
                    texture2D: WK.Texture.Red,
                    tag: "line1"
                    ),
            };

            this.dxUpdateSystem = (InputState lastInputState, InputState inputState) => UpdateSystem(lastInputState, inputState);
        }
Esempio n. 3
0
 public void Initialize(Vector2?playerPosition = null)
 {
     this.UIs = new List <IUI>()
     {
         new Button(
             rectangle: new Rectangle(10, 10, 230, 30),
             text: "Helpers_InputState",
             defaultTexture: WK.Texture.Red,
             mouseOverTexture: WK.Texture.Gray,
             spriteFont: WK.Font.font_7,
             tag: "goToHelpers_InputState",
             OnClickAction: null
             ),
         new Button(
             rectangle: new Rectangle(10, 50, 230, 30),
             text: "Helpers_JsonSerialization",
             defaultTexture: WK.Texture.LightGray,
             mouseOverTexture: WK.Texture.Gray,
             spriteFont: WK.Font.font_7,
             tag: "goToHelpers_JsonSerialization",
             OnClickAction: () => Game1.ChangeToScene(WK.Scene.Helpers_JsonSerialization)
             ),
         new Button(
             rectangle: new Rectangle(0, 470, 230, 30),
             text: "<- Menu",
             defaultTexture: WK.Texture.LightGray,
             mouseOverTexture: WK.Texture.Gray,
             spriteFont: WK.Font.font_7,
             tag: "goToMenu",
             OnClickAction: () => Game1.ChangeToScene(WK.Scene.Menu)
             ),
     };
 }
        public void Initialize(Vector2?playerPosition = null)
        {
            this.UIs = new List <IUI>()
            {
                new Label(
                    rectangle: new Rectangle(10, 10, 250, 50),
                    spriteFont: WK.Font.font_7,
                    text: "Click somewhere",
                    textAlignment: Label.TextAlignment.Midle_Center,
                    tag: ""
                    ),
                new Button(
                    rectangle: new Rectangle(0, 470, 230, 30),
                    text: "<- Entities",
                    defaultTexture: WK.Texture.LightGray,
                    mouseOverTexture: WK.Texture.Gray,
                    spriteFont: WK.Font.font_7,
                    tag: "goToEntities",
                    OnClickAction: () => Game1.ChangeToScene(WK.Scene.Entities)
                    ),
            };

            this.entities       = new List <IEntity>();
            this.dxUpdateSystem = (InputState lastInputState, InputState inputState) => SceneUpdateSystem(lastInputState, inputState);
        }
Esempio n. 5
0
        public void Update()
        {
            if (isGameOver == false)
            {
                gameGrid.Update();
                nextPiecePreview.Update(gameGrid.piece.nextPieceDesign);
                score.Update(scoreCount);
                Game1.gameData.score = scoreCount;
                //levelNumber.Update();
                lines.Update(lineCount);
            }

            gameOver.Update(isGameOver);


            KeyboardState keyboardState = Keyboard.GetState();

            if (isGameOver == true)
            {
                if (keyboardState.IsKeyDown(Keys.Q) && previousKeyboardState.IsKeyUp(Keys.Q))
                {
                    JsonSerialization.Update(Game1.gameData, WK.Default.GameDataFileName);
                    Game1.ChangeToScene(WK.Scene.MenuScene);
                }
            }


            previousKeyboardState = keyboardState;
        }
        public void Initialize(Vector2?playerPosition = null)
        {
            this.UIs = new List <IUI>()
            {
                new Button(
                    rectangle: new Rectangle(0, 470, 230, 30),
                    text: "<- Systems",
                    defaultTexture: WK.Texture.LightGray,
                    mouseOverTexture: WK.Texture.Gray,
                    spriteFont: WK.Font.font_7,
                    tag: "goToSystems",
                    OnClickAction: () => Game1.ChangeToScene(WK.Scene.Systems)
                    ),
            };

            Entity entity = new Entity(null, new Vector2());

            entity = new Entity(
                texture2D: Tools.Texture.CreateTriangle(Color.Pink, 100, 100, Tools.Texture.PointDirection.Right),
                centerPosition: new Vector2(ChristianGame.Default.canvasWidth / 2, ChristianGame.Default.canvasHeight / 2),
                dxUpdateSystem: (InputState lastInputState, InputState inputState) => {
                // Set rotation
                double angleInDegrees = Tools.MyMath.GetAngleInDegree(entity.rigidbody.centerPosition, inputState.Mouse_Position().ToVector2());

                entity.rigidbody.rotationDegree = (float)angleInDegrees;


                // Set position
                if (inputState.Left)
                {
                    entity.rigidbody.Move_X(-1);
                }
                else if (inputState.Right)
                {
                    entity.rigidbody.Move_X(1);
                }

                if (inputState.Up)
                {
                    entity.rigidbody.Move_Y(-1);
                }
                else if (inputState.Down)
                {
                    entity.rigidbody.Move_Y(1);
                }
            }
                );

            this.entities = new List <IEntity>()
            {
                entity
            };
        }
Esempio n. 7
0
 public void Initialize(Vector2?playerPosition = null)
 {
     this.UIs = new List <IUI>()
     {
         new Button(
             rectangle: new Rectangle(10, 10, 230, 30),
             text: "Components_Animation",
             defaultTexture: WK.Texture.LightGray,
             mouseOverTexture: WK.Texture.Gray,
             spriteFont: WK.Font.font_7,
             tag: "goToComponents_Animation",
             OnClickAction: () => Game1.ChangeToScene(WK.Scene.Components_Animation)
             ),
         new Button(
             rectangle: new Rectangle(10, 50, 230, 30),
             text: "Components_Camera",
             defaultTexture: WK.Texture.LightGray,
             mouseOverTexture: WK.Texture.Gray,
             spriteFont: WK.Font.font_7,
             tag: "goToComponents_Camera",
             OnClickAction: () => Game1.ChangeToScene(WK.Scene.Components_Camera)
             ),
         new Button(
             rectangle: new Rectangle(10, 90, 230, 30),
             text: "Components_Map",
             defaultTexture: WK.Texture.LightGray,
             mouseOverTexture: WK.Texture.Gray,
             spriteFont: WK.Font.font_7,
             tag: "goToComponents_Map",
             OnClickAction: () => Game1.ChangeToScene(WK.Scene.Components_Map)
             ),
         new Button(
             rectangle: new Rectangle(10, 130, 230, 30),
             text: "Components_Rigidbody",
             defaultTexture: WK.Texture.LightGray,
             mouseOverTexture: WK.Texture.Gray,
             spriteFont: WK.Font.font_7,
             tag: "goToComponents_Rigidbody",
             OnClickAction: () => Game1.ChangeToScene(WK.Scene.Components_Rigidbody)
             ),
         new Button(
             rectangle: new Rectangle(0, 470, 230, 30),
             text: "<- Menu",
             defaultTexture: WK.Texture.LightGray,
             mouseOverTexture: WK.Texture.Gray,
             spriteFont: WK.Font.font_7,
             tag: "goToMenu",
             OnClickAction: () => Game1.ChangeToScene(WK.Scene.Menu)
             ),
     };
 }
Esempio n. 8
0
 public void Initialize(Vector2?playerPosition = null)
 {
     this.UIs = new List <IUI>()
     {
         new Label(
             rectangle: new Rectangle(260, 10, 230, 30),
             spriteFont: WK.Font.font_7,
             "Others",
             Label.TextAlignment.Midle_Center,
             ""
             ),
         new Button(
             rectangle: new Rectangle(10, 10, 230, 30),
             text: "PunchHole",
             defaultTexture: WK.Texture.LightGray,
             mouseOverTexture: WK.Texture.Gray,
             spriteFont: WK.Font.font_7,
             tag: "goToPunchHole",
             OnClickAction: () => Game1.ChangeToScene(WK.Scene.Others_PunchHole)
             ),
         new Button(
             rectangle: new Rectangle(10, 50, 230, 30),
             text: "Lights",
             defaultTexture: WK.Texture.LightGray,
             mouseOverTexture: WK.Texture.Gray,
             spriteFont: WK.Font.font_7,
             tag: "goToLights",
             OnClickAction: () => Game1.ChangeToScene(WK.Scene.Scene_Others_Lights)
             ),
         new Button(
             rectangle: new Rectangle(10, 90, 230, 30),
             text: "Tiled",
             defaultTexture: WK.Texture.LightGray,
             mouseOverTexture: WK.Texture.Gray,
             spriteFont: WK.Font.font_7,
             tag: "goToTiled",
             OnClickAction: () => Game1.ChangeToScene(WK.Scene.Scene_Others_Tiled)
             ),
         new Button(
             rectangle: new Rectangle(0, 470, 230, 30),
             text: "<- Menu",
             defaultTexture: WK.Texture.LightGray,
             mouseOverTexture: WK.Texture.Gray,
             spriteFont: WK.Font.font_7,
             tag: "goToMenu",
             OnClickAction: () => Game1.ChangeToScene(WK.Scene.Menu)
             ),
     };
 }
 public void Initialize(Vector2? playerPosition = null)
 {
     this.UIs = new List<IUI>()
     {
         new Label(
             rectangle: new Rectangle(250, 10, 230, 30),
             spriteFont: WK.Font.font_7,
             text: "Score:",
             textAlignment: Label.TextAlignment.Midle_Center,
             tag: ""
         ),
         new Button(
             rectangle: new Rectangle (10, 10, 230, 30),
             text: "Save",
             defaultTexture: WK.Texture.LightGray,
             mouseOverTexture: WK.Texture.Gray,
             spriteFont: WK.Font.font_7,
             tag: "save",
             OnClickAction: () => JsonSerialization.Update<GameData>(Game1.gameData, ChristianGame.Default.GameDataFileName)
         ),
         new Button(
             rectangle: new Rectangle (10, 50, 230, 30),
             text: "+",
             defaultTexture: WK.Texture.LightGray,
             mouseOverTexture: WK.Texture.Gray,
             spriteFont: WK.Font.font_7,
             tag: "plus",
             OnClickAction: () => Game1.gameData.score++
         ),
         new Button(
             rectangle: new Rectangle (10, 90, 230, 30),
             text: "-",
             defaultTexture: WK.Texture.LightGray,
             mouseOverTexture: WK.Texture.Gray,
             spriteFont: WK.Font.font_7,
             tag: "minus",
             OnClickAction: () => Game1.gameData.score--
         ),
         new Button(
             rectangle: new Rectangle (0, 470, 230, 30),
             text: "<- Helpers",
             defaultTexture: WK.Texture.LightGray,
             mouseOverTexture: WK.Texture.Gray,
             spriteFont: WK.Font.font_7,
             tag: "goToComponents",
             OnClickAction: () => Game1.ChangeToScene(WK.Scene.Helpers)
         ),
     };
 }
        public void Initialize(Vector2?playerPosition = null)
        {
            this.camera = new Camera();

            this.UIs = new List <IUI>()
            {
                new Button(
                    rectangle: new Rectangle(10, 10, 230, 30),
                    text: "Entities_Bullet",
                    defaultTexture: WK.Texture.LightGray,
                    mouseOverTexture: WK.Texture.Gray,
                    spriteFont: WK.Font.font_7,
                    tag: "goToEntities_Bullet",
                    OnClickAction: () => Game1.ChangeToScene(WK.Scene.Entities_Bullet)
                    ),
                new Button(
                    rectangle: new Rectangle(10, 50, 230, 30),
                    text: "Entities_Line",
                    defaultTexture: WK.Texture.LightGray,
                    mouseOverTexture: WK.Texture.Gray,
                    spriteFont: WK.Font.font_7,
                    tag: "goToEntities_Line",
                    OnClickAction: () => Game1.ChangeToScene(WK.Scene.Entities_Line)
                    ),
                new Button(
                    rectangle: new Rectangle(10, 90, 230, 30),
                    text: "Entities_Prefab",
                    defaultTexture: WK.Texture.Red,
                    mouseOverTexture: WK.Texture.Gray,
                    spriteFont: WK.Font.font_7,
                    tag: "goToEntities_Prefab",
                    OnClickAction: null
                    ),
                new Button(
                    rectangle: new Rectangle(0, 470, 230, 30),
                    text: "<- Menu",
                    defaultTexture: WK.Texture.LightGray,
                    mouseOverTexture: WK.Texture.Gray,
                    spriteFont: WK.Font.font_7,
                    tag: "goToMenu",
                    OnClickAction: () => Game1.ChangeToScene(WK.Scene.Menu)
                    ),
            };
        }
        public void Initialize(Vector2?playerPosition = null)
        {
            Dictionary <int, Texture2D> tileTextures = WK.Texture.Tiles.Tiles2.tileTextures;

            this.map = new Map(tileTextures, WK.Map.map0);

            this.UIs = new List <IUI>()
            {
                new Button(
                    rectangle: new Rectangle(0, 470, 230, 30),
                    text: "<- Components",
                    defaultTexture: WK.Texture.LightGray,
                    mouseOverTexture: WK.Texture.Gray,
                    spriteFont: WK.Font.font_7,
                    tag: "goToComponents",
                    OnClickAction: () => Game1.ChangeToScene(WK.Scene.Components)
                    ),
            };
        }
        public void Initialize(Vector2?playerPosition = null)
        {
            this.UIs = new List <IUI>()
            {
                new Button(
                    rectangle: new Rectangle(0, 470, 230, 30),
                    text: "<- Components",
                    defaultTexture: WK.Texture.LightGray,
                    mouseOverTexture: WK.Texture.Gray,
                    spriteFont: WK.Font.font_7,
                    tag: "goToComponents",
                    OnClickAction: () => Game1.ChangeToScene(WK.Scene.Components)
                    ),
            };

            this.entities = new List <IEntity>()
            {
                new MyCharacter()
            };
        }
Esempio n. 13
0
        public void Initialize(Vector2?playerPosition = null)
        {
            this.position  = new Vector2(ChristianGame.Default.canvasWidth / 2, ChristianGame.Default.canvasHeight / 2);
            this.camera    = new Camera();
            this.texture2D = WK.Texture.Red;

            this.UIs = new List <IUI>()
            {
                new Button(
                    rectangle: new Rectangle(0, 470, 230, 30),
                    text: "<- Components",
                    defaultTexture: WK.Texture.LightGray,
                    mouseOverTexture: WK.Texture.Gray,
                    spriteFont: WK.Font.font_7,
                    tag: "goToComponents",
                    OnClickAction: () => Game1.ChangeToScene(WK.Scene.Components)
                    ),
                new Button(
                    rectangle: new Rectangle(100, 100, 100, 100),
                    text: "test me",
                    defaultTexture: WK.Texture.LightGray,
                    mouseOverTexture: WK.Texture.Gray,
                    spriteFont: WK.Font.font_7,
                    tag: "test",
                    OnClickAction: null
                    ),
                new Label(new Rectangle(10, 10, 200, 30), WK.Font.font_7, "Use \"Up\", \"Down\", \"Right\", \"Left\"\nto move camera", Label.TextAlignment.Midle_Left, "", WK.Texture.LightGray),
            };

            Texture2D Red = Tools.Texture.CreateColorTexture(Color.Red, Width: 50, Height: 50);

            this.entities = new List <IEntity>()
            {
                new Entity(Red, new Vector2(ChristianGame.Default.canvasWidth / 2, ChristianGame.Default.canvasHeight / 2), tag: "player", dxUpdateSystem: (InputState lastInputState, InputState inputState) => UpdateSystem(lastInputState, inputState)),
            };
        }
Esempio n. 14
0
        public void Initialize(Vector2?playerPosition = null)
        {
            this.UIs = new List <IUI>()
            {
                new Button(
                    rectangle: new Rectangle(10, 10, 230, 30),
                    text: "Jump",
                    defaultTexture: WK.Texture.LightGray,
                    mouseOverTexture: WK.Texture.Gray,
                    spriteFont: WK.Font.font_7,
                    tag: "jump",
                    OnClickAction: null
                    ),
                new Button(
                    rectangle: new Rectangle(0, 470, 230, 30),
                    text: "<- Components",
                    defaultTexture: WK.Texture.LightGray,
                    mouseOverTexture: WK.Texture.Gray,
                    spriteFont: WK.Font.font_7,
                    tag: "goToComponents",
                    OnClickAction: () => Game1.ChangeToScene(WK.Scene.Components)
                    ),
            };


            Entity entity = new Entity(
                texture2D: WK.Texture.Player.animationsLeft[CharacterState.IdleLeft][0],
                centerPosition: new Vector2(ChristianGame.Default.canvasWidth / 2, ChristianGame.Default.canvasHeight / 2),
                dxUpdateSystem: null//() => Jump()
                );

            entity.rigidbody.force = entity.rigidbody.force + new Vector2(0, 1);

            this.entities = new List <IEntity>();
            this.entities.Add(entity);
        }
Esempio n. 15
0
 public void Initialize(Vector2?playerPosition = null)
 {
     this.UIs = new List <IUI>()
     {
         new Button(
             rectangle: new Rectangle(10, 10, 230, 30),
             text: "Systems_DrawSystems",
             defaultTexture: WK.Texture.LightGray,
             mouseOverTexture: WK.Texture.Gray,
             spriteFont: WK.Font.font_7,
             tag: "goToDrawSystems",
             OnClickAction: () => Game1.ChangeToScene(WK.Scene.Systems_DrawSystems)
             ),
         new Button(
             rectangle: new Rectangle(0, 470, 230, 30),
             text: "<- Menu",
             defaultTexture: WK.Texture.LightGray,
             mouseOverTexture: WK.Texture.Gray,
             spriteFont: WK.Font.font_7,
             tag: "goToMenu",
             OnClickAction: () => Game1.ChangeToScene(WK.Scene.Menu)
             ),
     };
 }
        public void Initialize(Vector2?playerPosition = null)
        {
            //this.camera = new Camera(Game1.spriteBatch.GraphicsDevice.Viewport);

            this.UIs = new List <IUI>()
            {
                new Label(
                    rectangle: new Rectangle(260, 10, 230, 30),
                    spriteFont: WK.Font.font_7,
                    "Menu",
                    Label.TextAlignment.Midle_Center,
                    ""
                    ),
                new Button(
                    rectangle: new Rectangle(10, 10, 230, 30),
                    text: "Components",
                    defaultTexture: WK.Texture.LightGray,
                    mouseOverTexture: WK.Texture.Gray,
                    spriteFont: WK.Font.font_7,
                    tag: "goToComponents",
                    OnClickAction: () => Game1.ChangeToScene(WK.Scene.Components)
                    ),
                new Button(
                    rectangle: new Rectangle(10, 50, 230, 30),
                    text: "Entities",
                    defaultTexture: WK.Texture.LightGray,
                    mouseOverTexture: WK.Texture.Gray,
                    spriteFont: WK.Font.font_7,
                    tag: "goToEntities",
                    OnClickAction: () => Game1.ChangeToScene(WK.Scene.Entities)
                    ),
                new Button(
                    rectangle: new Rectangle(10, 90, 230, 30),
                    text: "Helpers",
                    defaultTexture: WK.Texture.LightGray,
                    mouseOverTexture: WK.Texture.Gray,
                    spriteFont: WK.Font.font_7,
                    tag: "goToHelpers",
                    OnClickAction: () => Game1.ChangeToScene(WK.Scene.Helpers)
                    ),
                new Button(
                    rectangle: new Rectangle(10, 130, 230, 30),
                    text: "Tools",
                    defaultTexture: WK.Texture.LightGray,
                    mouseOverTexture: WK.Texture.Gray,
                    spriteFont: WK.Font.font_7,
                    tag: "goToTools",
                    OnClickAction: () => Game1.ChangeToScene(WK.Scene.Tools)
                    ),
                new Button(
                    rectangle: new Rectangle(10, 170, 230, 30),
                    text: "UI",
                    defaultTexture: WK.Texture.LightGray,
                    mouseOverTexture: WK.Texture.Gray,
                    spriteFont: WK.Font.font_7,
                    tag: "goToUI",
                    OnClickAction: () => Game1.ChangeToScene(WK.Scene.UI)
                    ),
                new Button(
                    rectangle: new Rectangle(10, 210, 230, 30),
                    text: "Systems",
                    defaultTexture: WK.Texture.LightGray,
                    mouseOverTexture: WK.Texture.Gray,
                    spriteFont: WK.Font.font_7,
                    tag: "goToSystems",
                    OnClickAction: () => Game1.ChangeToScene(WK.Scene.Systems)
                    ),

                new Button(
                    rectangle: new Rectangle(250, 210, 230, 30),
                    text: "Others",
                    defaultTexture: WK.Texture.LightGray,
                    mouseOverTexture: WK.Texture.Gray,
                    spriteFont: WK.Font.font_7,
                    tag: "goToOthers",
                    OnClickAction: () => Game1.ChangeToScene(WK.Scene.Others)
                    ),
            };
        }
Esempio n. 17
0
        public void Initialize(Vector2?playerPosition = null)
        {
            UIs = new List <IUI>()
            {
                new Button(
                    rectangle: new Rectangle(360, 10, 100, 50),
                    text: "Hello World",
                    defaultTexture: WK.Texture.Green,
                    mouseOverTexture: WK.Texture.Red,
                    spriteFont: WK.Font.font_7,
                    tag: "",
                    OnClickAction: () => Console.WriteLine("User click button!")
                    ),

                // Left
                new Label(new Rectangle(10, 10, 100, 30), WK.Font.font_7, "My Text", Label.TextAlignment.Top_Left, tag: "", WK.Texture.Green),
                new Label(new Rectangle(10, 50, 100, 30), WK.Font.font_7, "My Text", Label.TextAlignment.Midle_Left, tag: "", WK.Texture.Green),
                new Label(new Rectangle(10, 90, 100, 30), WK.Font.font_7, "My Text", Label.TextAlignment.Down_Left, tag: "", WK.Texture.Green),

                // Center
                new Label(new Rectangle(120, 10, 100, 30), WK.Font.font_7, "My Text", Label.TextAlignment.Top_Center, tag: "", WK.Texture.Green),
                new Label(new Rectangle(120, 50, 100, 30), WK.Font.font_7, "My Text", Label.TextAlignment.Midle_Center, tag: "", WK.Texture.Green),
                new Label(new Rectangle(120, 90, 100, 30), WK.Font.font_7, "My Text", Label.TextAlignment.Down_Center, tag: "", WK.Texture.Green),

                // Right
                new Label(new Rectangle(230, 10, 100, 30), WK.Font.font_7, "My Text", Label.TextAlignment.Top_Right, tag: "", WK.Texture.Green),
                new Label(new Rectangle(230, 50, 100, 30), WK.Font.font_7, "My Text", Label.TextAlignment.Midle_Right, tag: "", WK.Texture.Green),
                new Label(new Rectangle(230, 90, 100, 30), WK.Font.font_7, "My Text", Label.TextAlignment.Down_Right, tag: "", WK.Texture.Green),


                new HealthBar(Tools.Texture.CreateColorTexture(Color.Green), Tools.Texture.CreateColorTexture(Color.Red), new Rectangle(10, 130, 50, 10), HealthBar.Direction.Right),
                new HealthBar(Tools.Texture.CreateColorTexture(Color.Green), Tools.Texture.CreateColorTexture(Color.Red), new Rectangle(10, 150, 50, 10), HealthBar.Direction.Left),

                new HealthBar(Tools.Texture.CreateColorTexture(Color.Green), Tools.Texture.CreateColorTexture(Color.Red), new Rectangle(10, 175, 10, 50), HealthBar.Direction.Up),
                new HealthBar(Tools.Texture.CreateColorTexture(Color.Green), Tools.Texture.CreateColorTexture(Color.Red), new Rectangle(30, 175, 10, 50), HealthBar.Direction.Down),

                new Label(
                    rectangle: new Rectangle(100, 150, 100, 30),
                    spriteFont: WK.Font.font_7,
                    text: textOfChars,
                    textAlignment: Label.TextAlignment.Top_Left,
                    tag: "",
                    lineSpacing: 7 + 2
                    ),

                new Label(
                    rectangle: new Rectangle(50, 350, 450, 60),
                    spriteFont: WK.Font.font_7,
                    text: textOfChars,
                    textAlignment: Label.TextAlignment.Top_Left,
                    tag: "",
                    lineSpacing: 14 + 2
                    ),


                new Button(
                    rectangle: new Rectangle(360, 100, 100, 50),
                    text: "Play sound",
                    defaultTexture: Tools.Texture.CreateColorTexture(Color.Green),
                    mouseOverTexture: Tools.Texture.CreateColorTexture(Color.Red),
                    spriteFont: WK.Font.font_7,
                    tag: "SoundButton",
                    OnClickAction: () => soundEffects.First().Play()
                    ),

                new Button(
                    rectangle: new Rectangle(0, 470, 230, 30),
                    text: "<- Menu",
                    defaultTexture: WK.Texture.LightGray,
                    mouseOverTexture: WK.Texture.Gray,
                    spriteFont: WK.Font.font_7,
                    tag: "goToMenu",
                    OnClickAction: () => Game1.ChangeToScene(WK.Scene.Menu)
                    )
            };

            this.soundEffects = new List <SoundEffect>()
            {
                Tools.Sound.GetSoundEffect(Path.Combine("Sounds", "EatingSound_WAV"))
            };

            this.dxUpdateSystem = (InputState lastInputState, InputState inputState) => Update(lastInputState, inputState);
        }
        public void Initialize(Vector2?playerPosition = null)
        {
            subAtlas_1 = Tools.Texture.CropTexture(
                originalTexture: Tools.Texture.GetTexture("MyAtlasTexture"),
                extractRectangle: new Rectangle(0, 0, 50, 50)
                );
            subAtlas_2 = Tools.Texture.CropTexture(
                originalTexture: Tools.Texture.GetTexture("MyAtlasTexture"),
                extractRectangle: new Rectangle(50, 0, 50, 50)
                );
            subAtlas_3 = Tools.Texture.CropTexture(
                originalTexture: Tools.Texture.GetTexture("MyAtlasTexture"),
                extractRectangle: new Rectangle(0, 50, 50, 50)
                );
            subAtlas_4 = Tools.Texture.CropTexture(
                originalTexture: Tools.Texture.GetTexture("MyAtlasTexture"),
                extractRectangle: new Rectangle(50, 50, 50, 50)
                );

            circle_1 = Tools.Texture.CreateCircleTexture(Color.Green, 3);
            circle_2 = Tools.Texture.CreateCircleTexture(Color.Green, 4);
            circle_3 = Tools.Texture.CreateCircleTexture(Color.Green, 25);
            circle_4 = Tools.Texture.CreateCircleTexture(Color.Green, 26);

            triangle_Up = Tools.Texture.CreateTriangle(
                color: Color.Red,
                Width: 40,
                Height: 40,
                pointDirection: Tools.Texture.PointDirection.Up
                );
            triangle_Down = Tools.Texture.CreateTriangle(
                color: Color.Red,
                Width: 40,
                Height: 40,
                pointDirection: Tools.Texture.PointDirection.Down
                );
            triangle_Right = Tools.Texture.CreateTriangle(
                color: Color.Red,
                Width: 40,
                Height: 40,
                pointDirection: Tools.Texture.PointDirection.Right
                );
            triangle_Left = Tools.Texture.CreateTriangle(
                color: Color.Red,
                Width: 40,
                Height: 40,
                pointDirection: Tools.Texture.PointDirection.Left
                );

            fontMap = Tools.Texture.GetTexture("MyFont_130x28_PNG");

            fontMap_Green = Tools.Texture.ReColorTexture(fontMap, Color.Green);
            fontMap_Red   = Tools.Texture.ReColorTexture(fontMap, Color.Red);

            textureNormal            = Tools.Texture.GetTexture("MyAtlasTexture");
            textureFlippedHorizontal = Tools.Texture.FlipHorizontal(textureNormal);

            this.UIs = new List <IUI>()
            {
                new Button(
                    rectangle: new Rectangle(0, 470, 230, 30),
                    text: "<- Menu",
                    defaultTexture: WK.Texture.LightGray,
                    mouseOverTexture: WK.Texture.Gray,
                    spriteFont: WK.Font.font_7,
                    tag: "goToMenu",
                    OnClickAction: () => Game1.ChangeToScene(WK.Scene.Menu)
                    )
            };

            this.dxDrawSystem = (SpriteBatch spriteBatch) => DrawSystem(spriteBatch);
        }
Esempio n. 19
0
 public void Update()
 {
     playButton.Update(OnClickAction: () => Game1.ChangeToScene(WK.Scene.GameScene)
                       );
 }