Example #1
0
        public HumanAIScreen(Game1 game)
        {
            this._game = game;
            this._screen = ScreenType.Character;
            this.clientBounds = game.Window.ClientBounds;
            this._game.IsMouseVisible = false;

            arrowInputSystemID = game.RegisterSystem(new ArrowInputSystem(game, 1));
            handInitSystemID = game.RegisterSystem(new HandInitSystem(game));
            controllerInputSystemID = game.RegisterSystem(new ControllerInputSystem(game, 2));
            selectsInputID1 = game.RegisterSystem(new SelectInputSystem(game, 1));
            selectsInputID2 = game.RegisterSystem(new SelectInputSystem(game, 2));
            mapRendererID = game.RegisterSystem(new MapRenderer(game));
            handRenderID = game.RegisterSystem(new HandRenderer1(game));
            screenInitSystemID = game.RegisterSystem(new ScreenInitializationSystem(game));

            game.SetSystemCallOrder(new List<int>
             {
                screenInitSystemID,
                handInitSystemID,
                arrowInputSystemID,
                controllerInputSystemID,
                selectsInputID1,
                selectsInputID2,
                mapRendererID,
                handRenderID
             });

            game.AddObject(new HandObject1(game, 1));
            game.AddObject(new HandObject1(game, 2));
        }
Example #2
0
        public MapScreen(Game1 game)
        {
            this._game = game;
            this._screen = ScreenType.Map;
            this.clientBounds = game.Window.ClientBounds;
            this._game.IsMouseVisible = true;

            arrowInputSystemID = game.RegisterSystem(new ArrowInputSystem(game, 1));
            controllerInputSystemID = game.RegisterSystem(new ControllerInputSystem(game, 1));
            mapRendererID = game.RegisterSystem(new MapRenderer(game));
            mapInitSystemID = game.RegisterSystem(new ScreenInitializationSystem(game));
            //modeRendererID = game.RegisterSystem(new ModeTextRenderer(game));
            modeInputSystemID = game.RegisterSystem(new ModeInputSystem(game));
            mapInputSystemID = game.RegisterSystem(new MouseInputsystem(game));

            game.SetSystemCallOrder(new List<int>
             {
                mapInitSystemID,
                arrowInputSystemID,
                controllerInputSystemID,
                modeInputSystemID,
                mapRendererID,
                mapInputSystemID
                //modeRendererID
             });

            game.AddObject(new TextObject1(game));
        }
Example #3
0
        public StartScreen(Game1 game)
        {
            this._game = game;
            this._screen = ScreenType.Start;
            this.clientBounds = game.Window.ClientBounds;

            startScreenSystemID = game.RegisterSystem(new ScreenInputSystem(game, this._screen));
            screenInitSystemID = game.RegisterSystem(new ScreenInitializationSystem(game));
            screenRendererID = game.RegisterSystem(new MapRenderer(game));

            game.SetSystemCallOrder(new List<int>
             {
                 screenInitSystemID,
                 startScreenSystemID,
                 screenRendererID

             });

            game.AddObject(new SceneObject(game, this._screen));
        }
Example #4
0
        public CreditsScreen(Game1 game)
        {
            this._game = game;
            this._screen = ScreenType.Character;
            this.clientBounds = game.Window.ClientBounds;
            this._game.IsMouseVisible = false;

            handInitSystemID = game.RegisterSystem(new HandInitSystem(game));

            if (game.winner == 1)
            {
                arrowInputSystemID = game.RegisterSystem(new ArrowInputSystem(game, 1));
                selectsInputID1 = game.RegisterSystem(new SelectInputSystem(game, 1));
            }
            else if (game.winner == 2)
            {
                controllerInputSystemID = game.RegisterSystem(new ControllerInputSystem(game, 2));
                selectsInputID2 = game.RegisterSystem(new SelectInputSystem(game, 2));
            }
            else
            {
                selectsInputID1 = game.RegisterSystem(new SelectInputSystem(game, 1));
                selectsInputID2 = game.RegisterSystem(new SelectInputSystem(game, 2));
            }
            mapRendererID = game.RegisterSystem(new MapRenderer(game));
            handRenderID = game.RegisterSystem(new HandRenderer1(game));
            screenInitSystemID = game.RegisterSystem(new ScreenInitializationSystem(game));
            switchSystemID = game.RegisterSystem(new SwitchScreenSystem(game));

            if (game.winner == 1)
            {
                game.SetSystemCallOrder(new List<int>
                 {
                    screenInitSystemID,
                    handInitSystemID,
                    arrowInputSystemID,
                    selectsInputID1,
                    mapRendererID,
                    handRenderID,
                    switchSystemID
                 });
            }
            else if (game.winner == 2)
            {
                game.SetSystemCallOrder(new List<int>
                 {
                    screenInitSystemID,
                    handInitSystemID,
                    controllerInputSystemID,
                    selectsInputID2,
                    mapRendererID,
                    handRenderID,
                    switchSystemID
                 });
            }
            else
            {
                game.SetSystemCallOrder(new List<int>
                 {
                    screenInitSystemID,
                    handInitSystemID,
                    arrowInputSystemID,
                    controllerInputSystemID,
                    selectsInputID1,
                    selectsInputID2,
                    mapRendererID,
                    handRenderID,
                    switchSystemID
                 });
            }

            game.AddObject(new HandObject2(game, 1));
            game.AddObject(new HandObject2(game, 2));
        }
Example #5
0
        public GameScreen(Game1 game, SpriteType player1, SpriteType player2)
        {
            game.IsMouseVisible = true;

            this.envFactory = new EnvironmentFactory(game);
            this.clientBounds = game.Window.ClientBounds;
            mapInitSystemID = game.RegisterSystem(new ScreenInitializationSystem(game));
            spriteInitSystemID1 = game.RegisterSystem(new SpriteInitializationSystem(game, 1));
            spriteInitSystemID2 = game.RegisterSystem(new SpriteInitializationSystem(game, 2));
            songInitSystemID = game.RegisterSystem(new SongInitializer(game));
            if (game.playe2 == PlayerType.Human)
            {
                controllerInputSystemID = game.RegisterSystem(new ControllerInputSystem(game, 2));
                //arrowInputSystemID = game.RegisterSystem(new ArrowInputSystem(game, 2));
                inputSystemID2 = game.RegisterSystem(new InputSystem(game, 2));
            }
            if (game.playe1 == PlayerType.Human)
            {
                arrowInputSystemID = game.RegisterSystem(new ArrowInputSystem(game, 1));
                //controllerInputSystemID = game.RegisterSystem(new ControllerInputSystem(game, 1));
                inputSystemID1 = game.RegisterSystem(new InputSystem(game, 1));
            }
            animationSystemID1 = game.RegisterSystem(new AnimationSystem(game, 1));
            animationSystemID2 = game.RegisterSystem(new AnimationSystem(game, 2));
            movementSystemID1 = game.RegisterSystem(new MovementSystem(game, 1));
            movementSystemID2 = game.RegisterSystem(new MovementSystem(game, 2));
            actionSystemID = game.RegisterSystem(new ActionSystem(game));
            physicsSystemID = game.RegisterSystem(new PhysicsSystem(game));
            boundsSystemID = game.RegisterSystem(new BoundsSystem(game));
            meshRendererID = game.RegisterSystem(new LinebatchMeshRenderSystem(game));
            collisionRendererID = game.RegisterSystem(new CollisionRenderSystem(game));
            mapRendererID = game.RegisterSystem(new MapRenderer(game));
            spriteRendererID = game.RegisterSystem(new SpriteRenderer(game));
            uiRendererID = game.RegisterSystem(new UIRenderer(game));
            transformResolverID = game.RegisterSystem(new PhysicsTransformResolverSystem(game));
            lifetimeSystemID = game.RegisterSystem(new LifetimeSystem(game));
            int aStarPathRendererID = game.RegisterSystem(new AStarPathRenderer(game));
            int aStarRendererID = game.RegisterSystem(new AStarPathfindingRenderer(game));
            int aiSystemID = game.RegisterSystem(new AISystem(game));
            int timerRendererID = game.RegisterSystem(new TimerRenderSystem(game));
            int timerSystemID = game.RegisterSystem(new TimerSystem(game));
            songSystemID = game.RegisterSystem(new MusicSystem(game));

            //services
            int collisionSystemID = game.RegisterSystem(new SATCollisionSystem(game, "Collision"));
            int aStarServiceID = game.RegisterSystem(new AStarPathfindingSystem(game, "Pathfinding", 50));

            if (game.playe1 == PlayerType.Human && game.playe2 == PlayerType.Human)
            {
                game.SetSystemCallOrder(new List<int>
                    {
                        this.mapInitSystemID,
                        this.spriteInitSystemID1,
                        this.spriteInitSystemID2,
                        this.songInitSystemID,
                        this.arrowInputSystemID,
                        this.controllerInputSystemID,
                        aiSystemID,
                        this.inputSystemID1,
                        this.inputSystemID2,
                        this.animationSystemID1,
                        this.animationSystemID2,
                        this.movementSystemID1,
                        this.movementSystemID2,
                        this.actionSystemID,
                        this.physicsSystemID,
                        this.transformResolverID,
                        this.boundsSystemID,
                        this.lifetimeSystemID,
                        //this.physicsSystemID,
                        this.meshRendererID,
                        this.mapRendererID,
                        this.collisionRendererID,
                        this.spriteRendererID,
                        this.uiRendererID,
                        aStarRendererID,
                        aStarPathRendererID,
                        songSystemID
                    });
            }
            else if (game.playe1 == PlayerType.Human)
            {
                game.SetSystemCallOrder(new List<int>
                    {
                        this.mapInitSystemID,
                        this.spriteInitSystemID1,
                        this.spriteInitSystemID2,
                        this.songInitSystemID,
                        this.arrowInputSystemID,
                        aiSystemID,
                        this.inputSystemID1,
                        this.animationSystemID1,
                        this.animationSystemID2,
                        this.movementSystemID1,
                        this.movementSystemID2,
                        this.actionSystemID,
                        this.physicsSystemID,
                        this.transformResolverID,
                        this.boundsSystemID,
                        this.lifetimeSystemID,
                        //this.physicsSystemID,
                        this.meshRendererID,
                        this.mapRendererID,
                        this.collisionRendererID,
                        this.spriteRendererID,
                        this.uiRendererID,
                        aStarRendererID,
                        aStarPathRendererID,
                        songSystemID
                    });
            }
            else if (game.playe2 == PlayerType.Human)
            {
                game.SetSystemCallOrder(new List<int>
                    {
                        this.mapInitSystemID,
                        this.spriteInitSystemID1,
                        this.spriteInitSystemID2,
                        this.songInitSystemID,
                        this.controllerInputSystemID,
                        aiSystemID,
                        this.inputSystemID2,
                        this.animationSystemID1,
                        this.animationSystemID2,
                        this.movementSystemID1,
                        this.movementSystemID2,
                        this.actionSystemID,
                        this.physicsSystemID,
                        this.transformResolverID,
                        this.boundsSystemID,
                        this.lifetimeSystemID,
                        //this.physicsSystemID,
                        this.meshRendererID,
                        this.mapRendererID,
                        this.collisionRendererID,
                        this.spriteRendererID,
                        this.uiRendererID,
                        aStarRendererID,
                        aStarPathRendererID,
                        songSystemID
                    });
            }

            if (game.playe1 == PlayerType.Human)
            {
                if (player1 == SpriteType.Yoshi)
                {
                    this.p1 = DynamicEntityFactory.BuildPlayerControlledEntity(
                         game,
                         1,
                         Color.Green,
                         new Vector2(100, 0),
                         0.0f,
                         new Vector2(1.0f, 1.0f),
                         400,
                         1000,
                         SpriteType.Yoshi,
                         new List<Shape>
                                {
                                    //Shape.BuildRectangle(new Rectangle(-55, -60, 90, 60)),
                                    Shape.BuildRectangle(new Rectangle(-40, 0, 120, 60)),
                                    Shape.BuildRectangle(new Rectangle(25, 60, 40, 30))
                                },
                         MoveDefinitions.GetYoshiMoves()
                     );
                }
                else
                {
                    this.p1 = DynamicEntityFactory.BuildPlayerControlledEntity(
                        game,
                        1,
                        Color.Green,
                        new Vector2(100, 0),
                        0.0f,
                        new Vector2(1.0f, 1.0f),
                        300,
                        1000,
                        SpriteType.Kirby,
                        new List<Shape>
                            {
                                Shape.BuildRectangle(new Rectangle(-60, -60, 110, 110))
                            },
                        MoveDefinitions.GetKirbyMoves()
                    );

                    //kirby.AddComponent(new LifetimeComponent(kirby, 5000));
                    //kirby.SetParent(yoshi);
                }
            }
            else
            {
                if (player1 == SpriteType.Yoshi)
                {
                    this.p1 = DynamicEntityFactory.BuildComputerControlledEntity(
                        game,
                        1,
                        Color.Green,
                        new Vector2(800, 0),
                        0.0f,
                        new Vector2(1.0f, 1.0f),
                        250,
                        500,
                        SpriteType.Yoshi,
                        new List<Shape>
                            {
                                    Shape.BuildRectangle(new Rectangle(-40, 0, 120, 60)),
                                    Shape.BuildRectangle(new Rectangle(25, 60, 40, 30))
                            },
                        MoveDefinitions.GetYoshiMoves(),
                        this.p2
                    );
                }
                else
                {
                    this.p1 = DynamicEntityFactory.BuildComputerControlledEntity(
                        game,
                        1,
                        Color.Green,
                        new Vector2(800, 0),
                        0.0f,
                        new Vector2(1.0f, 1.0f),
                        250,
                        500,
                        SpriteType.Kirby,
                        new List<Shape>
                            {
                                    Shape.BuildRectangle(new Rectangle(-60, -60, 110, 110))
                            },
                        MoveDefinitions.GetKirbyMoves(),
                        this.p2
                        );
                }
            }

            game.AddObject(p1);

            if (game.playe1 == PlayerType.Human)
            {
                if (player2 == SpriteType.Yoshi)
                {
                    this.p2 = DynamicEntityFactory.BuildPlayerControlledEntity(
                         game,
                         2,
                         Color.Pink,
                         new Vector2(800, 0),
                         0.0f,
                         new Vector2(1.0f, 1.0f),
                         400,
                         500,
                         SpriteType.Yoshi,
                         new List<Shape>
                                {
                                    //Shape.BuildRectangle(new Rectangle(-55, -60, 90, 60)),
                                    Shape.BuildRectangle(new Rectangle(-40, 0, 120, 60)),
                                    Shape.BuildRectangle(new Rectangle(25, 60, 40, 30))
                                },
                         MoveDefinitions.GetYoshiMoves()
                     );
                }
                else
                {

                    this.p2 = DynamicEntityFactory.BuildPlayerControlledEntity(
                        game,
                        2,
                        Color.Pink,
                        new Vector2(500, 0),
                        0.0f,
                        new Vector2(1.0f, 1.0f),
                        300,
                        10000,
                        SpriteType.Kirby,
                        new List<Shape>
                            {
                                Shape.BuildRectangle(new Rectangle(-60, -60, 110, 110))
                            },
                        MoveDefinitions.GetKirbyMoves()
                    );

                    //this.p2 = DynamicEntityFactory.BuildComputerControlledEntity(
                    //    game,
                    //    2,
                    //    Color.Pink,
                    //    new Vector2(800, 0),
                    //    0.0f,
                    //    new Vector2(1.0f, 1.0f),
                    //    250,
                    //    500,
                    //    SpriteType.Kirby,
                    //    new List<Shape>
                    //        {
                    //            Shape.BuildRectangle(new Rectangle(-60, -60, 110, 110))
                    //        },
                    //    MoveDefinitions.GetYoshiMoves(),
                    //    this.p1
                    //);
                }
            }
            else
            {
                if (player2 == SpriteType.Yoshi)
                {
                    this.p2 = DynamicEntityFactory.BuildComputerControlledEntity(
                        game,
                        2,
                        Color.Pink,
                        new Vector2(800, 0),
                        0.0f,
                        new Vector2(1.0f, 1.0f),
                        250,
                        500,
                        SpriteType.Yoshi,
                        new List<Shape>
                            {
                                    Shape.BuildRectangle(new Rectangle(-40, 0, 120, 60)),
                                    Shape.BuildRectangle(new Rectangle(25, 60, 40, 30))
                            },
                        MoveDefinitions.GetYoshiMoves(),
                        this.p1
                    );
                }
                else
                {
                    this.p2 = DynamicEntityFactory.BuildComputerControlledEntity(
                        game,
                        2,
                        Color.Pink,
                        new Vector2(800, 0),
                        0.0f,
                        new Vector2(1.0f, 1.0f),
                        250,
                        500,
                        SpriteType.Kirby,
                        new List<Shape>
                            {
                                    Shape.BuildRectangle(new Rectangle(-60, -60, 110, 110))
                            },
                        MoveDefinitions.GetKirbyMoves(),
                        this.p1
                        );
                }
            }

            game.AddObject(p2);

            if (game.mapType == MapType.Basic)
            {
                game.AddObject(new TextObject2(game, MapType.Basic));

                game.AddObject(envFactory.BuildStaticRectangularObstacle(
                    new Vector2(403, 347),
                    new Rectangle(0, -10, -378, -36),
                    2000.0f,
                    Color.Red));

                game.AddObject(envFactory.BuildStaticRectangularObstacle(
                    new Vector2(1173, 498),
                    new Rectangle(0, -10, -380, -37),
                    2000.0f,
                    Color.Red));

                game.AddObject(envFactory.BuildStaticRectangularObstacle(
                    new Vector2(1165, 119),
                    new Rectangle(0, -10, -530, -39),
                    2000.0f,
                    Color.Red));

                game.AddObject(envFactory.BuildStaticRectangularObstacle(
                    new Vector2(1050, 662),
                    new Rectangle(0, -10, -927, -1),
                    2000.0f,
                    Color.Red));

                AStarPathfindingSystem pathfinding = (AStarPathfindingSystem)game.GetService("Pathfinding");
                AStarNode node1 = new AStarNode(new Vector2(700, 50));
                AStarNode node2 = new AStarNode(new Vector2(320, 270), true);
                AStarNode node3 = new AStarNode(new Vector2(820, 400));
                AStarNode node4 = new AStarNode(new Vector2(700, 620), true);
                AStarNode node5 = new AStarNode(new Vector2(300, 620));
                node1.AddNeighbor(node2);
                node2.AddNeighbor(node1);
                node2.AddNeighbor(node3);
                node3.AddNeighbor(node2);
                node3.AddNeighbor(node4);
                node4.AddNeighbor(node3);
                node4.AddNeighbor(node5);
                node5.AddNeighbor(node4);
                AStarGraph graph = new AStarGraph(game, new List<AStarNode> { node1, node2, node3, node4, node5 });
                GameObject graphEntity = new GameObject(game);
                graphEntity.AddComponent(new AStarGraphComponent(graphEntity, graph));
                game.AddObject(graphEntity);
                game.CurrentPathfindingGraph = graph;

                game.AddObject(new SongObject(game, MapType.Basic));
            }
            else
            {
                game.AddObject(new TextObject2(game, MapType.Hyrule));

                game.AddObject(envFactory.BuildStaticRectangularObstacle(
                    new Vector2(303, 500),
                    new Rectangle(0, -10, -10, -120),
                    2000.0f,
                    Color.Red));

                game.AddObject(envFactory.BuildStaticRectangularObstacle(
                    new Vector2(302, 505),
                    new Rectangle(0, -10, -140, -10),
                    2000.0f,
                    Color.Red));

                game.AddObject(envFactory.BuildStaticRectangularObstacle(
                    new Vector2(815, 390),
                    new Rectangle(0, -10, -516, -10),
                    2000.0f,
                    Color.Red));

                //game.AddObject(envFactory.BuildStaticRectangularObstacle(
                //    new Vector2(704, 330),
                //    new Rectangle(0, -10, -109, -10),
                //    2000.0f,
                //    Color.Red));

                //game.AddObject(envFactory.BuildStaticRectangularObstacle(
                //    new Vector2(757, 223),
                //    new Rectangle(0, -10, -107, -10),
                //    2000.0f,
                //    Color.Red));

                game.AddObject(envFactory.BuildStaticRectangularObstacle(
                    new Vector2(1064, 510),
                    new Rectangle(0, -10, -250, -10),
                    2000.0f,
                    Color.Red));

                game.AddObject(envFactory.BuildStaticRectangularObstacle(
                    new Vector2(818, 510),
                    new Rectangle(0, -10, -10, -130),
                    2000.0f,
                    Color.Red));

                game.AddObject(envFactory.BuildStaticRectangularObstacle(
                    new Vector2(174, 800),
                    new Rectangle(0, -10, -10, -300),
                    2000.0f,
                    Color.Red));

                game.AddObject(envFactory.BuildStaticRectangularObstacle(
                    new Vector2(1066, 810),
                    new Rectangle(0, -10, -10, -306),
                    2000.0f,
                    Color.Red));

                AStarPathfindingSystem pathfinding = (AStarPathfindingSystem)game.GetService("Pathfinding");
                AStarNode node1 = new AStarNode(new Vector2(230, 480), true);
                AStarNode node2 = new AStarNode(new Vector2(320, 350));
                AStarNode node3 = new AStarNode(new Vector2(800, 350));
                AStarNode node4 = new AStarNode(new Vector2(890, 480), true);
                node1.AddNeighbor(node2);
                node2.AddNeighbor(node1);
                node2.AddNeighbor(node3);
                node3.AddNeighbor(node2);
                node3.AddNeighbor(node4);
                node4.AddNeighbor(node3);
                AStarGraph graph = new AStarGraph(game, new List<AStarNode> { node1, node2, node3, node4 });
                GameObject graphEntity = new GameObject(game);
                graphEntity.AddComponent(new AStarGraphComponent(graphEntity, graph));
                game.AddObject(graphEntity);
                game.CurrentPathfindingGraph = graph;

                game.AddObject(new SongObject(game, MapType.Hyrule));
            }

            //game.AddObject(envFactory.BuildStaticRectangularObstacle(
            //    new Vector2(clientBounds.Width / 2, clientBounds.Height),
            //    new Rectangle(-clientBounds.Width / 2, -10, clientBounds.Width, 20),
            //    2000.0f,
            //    Color.Red));

            //game.AddObject(envFactory.BuildStaticRectangularObstacle(
            //    new Vector2(clientBounds.Width / 2, clientBounds.Height / 3 * 2),
            //    new Rectangle(-clientBounds.Width / 2, -10, clientBounds.Width / 2, 20),
            //    2000.0f,
            //    Color.Red));

            //if (this._game.gameType == Types.GameTypes.Timed)
            //{
            //    game.AddObject(new TimeObject(game, new Vector2(0, 0), Color.Black));
            //}

            game.Character1 = this.p1;
            game.Character2 = this.p2;
        }