Exemplo n.º 1
0
        public override void Initialize(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            PongBallInstance      = new PongNewTry.Entities.PongBall(ContentManagerName, false);
            PongBallInstance.Name = "PongBallInstance";
            Border1Instance       = new PongNewTry.Entities.Border1(ContentManagerName, false);
            Border1Instance.Name  = "Border1Instance";
            Border2Instance       = new PongNewTry.Entities.Border2(ContentManagerName, false);
            Border2Instance.Name  = "Border2Instance";
            Border3Instance       = new PongNewTry.Entities.Border3(ContentManagerName, false);
            Border3Instance.Name  = "Border3Instance";
            Player1Instance       = new PongNewTry.Entities.Player1(ContentManagerName, false);
            Player1Instance.Name  = "Player1Instance";
            Player2Instance       = new PongNewTry.Entities.Player2(ContentManagerName, false);
            Player2Instance.Name  = "Player2Instance";
            HUDInstance           = new PongNewTry.Entities.HUD(ContentManagerName, false);
            HUDInstance.Name      = "HUDInstance";
            HUD2Instance          = new PongNewTry.Entities.HUD2(ContentManagerName, false);
            HUD2Instance.Name     = "HUD2Instance";
            // Not instantiating for  Border1Instance2 in Screens\GameScreen (Screen) because properties on the object prevent it
            PongBallInstanceVsBorder1Instance      = FlatRedBall.Math.Collision.CollisionManager.Self.CreateRelationship(PongBallInstance, Border1Instance);
            PongBallInstanceVsBorder1Instance.Name = "PongBallInstanceVsBorder1Instance";
            PongBallInstanceVsBorder1Instance.SetBounceCollision(0f, 1f, 2f);

            PongBallInstanceVsBorder2Instance      = FlatRedBall.Math.Collision.CollisionManager.Self.CreateRelationship(PongBallInstance, Border2Instance);
            PongBallInstanceVsBorder2Instance.Name = "PongBallInstanceVsBorder2Instance";
            PongBallInstanceVsBorder2Instance.SetBounceCollision(0f, 1f, 2f);

            PongBallInstanceVsBorder3Instance      = FlatRedBall.Math.Collision.CollisionManager.Self.CreateRelationship(PongBallInstance, Border3Instance);
            PongBallInstanceVsBorder3Instance.Name = "PongBallInstanceVsBorder3Instance";
            PongBallInstanceVsBorder3Instance.SetBounceCollision(0f, 1f, 2f);

            PongBallInstanceVsBorderInstance       = new FlatRedBall.Math.Collision.CollisionRelationship <PongNewTry.Entities.PongBall, PongNewTry.Entities.Border>();
            PongBallInstanceVsBorderInstance.Name  = "PongBallInstanceVsBorderInstance";
            Player1InstanceVsPongBallInstance      = FlatRedBall.Math.Collision.CollisionManager.Self.CreateRelationship(Player1Instance, PongBallInstance);
            Player1InstanceVsPongBallInstance.Name = "Player1InstanceVsPongBallInstance";
            Player1InstanceVsPongBallInstance.SetBounceCollision(1f, 0f, 2f);

            Player1InstanceVsBorder2Instance      = FlatRedBall.Math.Collision.CollisionManager.Self.CreateRelationship(Player1Instance, Border2Instance);
            Player1InstanceVsBorder2Instance.Name = "Player1InstanceVsBorder2Instance";
            Player1InstanceVsBorder2Instance.SetMoveCollision(0f, 1f);

            Player1InstanceVsBorder3Instance      = FlatRedBall.Math.Collision.CollisionManager.Self.CreateRelationship(Player1Instance, Border3Instance);
            Player1InstanceVsBorder3Instance.Name = "Player1InstanceVsBorder3Instance";
            Player1InstanceVsBorder3Instance.SetMoveCollision(0f, 1f);

            Player2InstanceVsBorder2Instance      = FlatRedBall.Math.Collision.CollisionManager.Self.CreateRelationship(Player2Instance, Border2Instance);
            Player2InstanceVsBorder2Instance.Name = "Player2InstanceVsBorder2Instance";
            Player2InstanceVsBorder2Instance.SetMoveCollision(0f, 1f);

            Player2InstanceVsBorder3Instance      = FlatRedBall.Math.Collision.CollisionManager.Self.CreateRelationship(Player2Instance, Border3Instance);
            Player2InstanceVsBorder3Instance.Name = "Player2InstanceVsBorder3Instance";
            Player2InstanceVsBorder3Instance.SetMoveCollision(0f, 1f);

            PongBallInstanceVsPlayer2Instance      = FlatRedBall.Math.Collision.CollisionManager.Self.CreateRelationship(PongBallInstance, Player2Instance);
            PongBallInstanceVsPlayer2Instance.Name = "PongBallInstanceVsPlayer2Instance";
            PongBallInstanceVsPlayer2Instance.SetBounceCollision(0f, 1f, 2f);



            PostInitialize();
            base.Initialize(addToManagers);
            if (addToManagers)
            {
                AddToManagers();
            }
        }
        public override void Initialize(bool addToManagers)
        {
            LoadStaticContent(ContentManagerName);
            PongBallInstance                       = new PongNewTry.Entities.PongBall(ContentManagerName, false);
            PongBallInstance.Name                  = "PongBallInstance";
            BorderInstance                         = new PongNewTry.Entities.Border(ContentManagerName, false);
            BorderInstance.Name                    = "BorderInstance";
            Border1Instance                        = new PongNewTry.Entities.Border1(ContentManagerName, false);
            Border1Instance.Name                   = "Border1Instance";
            Border2Instance                        = new PongNewTry.Entities.Border2(ContentManagerName, false);
            Border2Instance.Name                   = "Border2Instance";
            Border3Instance                        = new PongNewTry.Entities.Border3(ContentManagerName, false);
            Border3Instance.Name                   = "Border3Instance";
            Player1Instance                        = new PongNewTry.Entities.Player1(ContentManagerName, false);
            Player1Instance.Name                   = "Player1Instance";
            Player2Instance                        = new PongNewTry.Entities.Player2(ContentManagerName, false);
            Player2Instance.Name                   = "Player2Instance";
            HUDInstance                            = new PongNewTry.Entities.HUD(ContentManagerName, false);
            HUDInstance.Name                       = "HUDInstance";
            HUD2Instance                           = new PongNewTry.Entities.HUD2(ContentManagerName, false);
            HUD2Instance.Name                      = "HUD2Instance";
            PongBallInstanceVsBorder1Instance      = FlatRedBall.Math.Collision.CollisionManager.Self.CreateRelationship(PongBallInstance, Border1Instance);
            PongBallInstanceVsBorder1Instance.Name = "PongBallInstanceVsBorder1Instance";
            PongBallInstanceVsBorder1Instance.SetBounceCollision(0f, 1f, 2f);

            PongBallInstanceVsBorder2Instance      = FlatRedBall.Math.Collision.CollisionManager.Self.CreateRelationship(PongBallInstance, Border2Instance);
            PongBallInstanceVsBorder2Instance.Name = "PongBallInstanceVsBorder2Instance";
            PongBallInstanceVsBorder2Instance.SetBounceCollision(0f, 1f, 2f);

            PongBallInstanceVsBorder3Instance      = FlatRedBall.Math.Collision.CollisionManager.Self.CreateRelationship(PongBallInstance, Border3Instance);
            PongBallInstanceVsBorder3Instance.Name = "PongBallInstanceVsBorder3Instance";
            PongBallInstanceVsBorder3Instance.SetBounceCollision(0f, 1f, 2f);

            PongBallInstanceVsBorderInstance      = FlatRedBall.Math.Collision.CollisionManager.Self.CreateRelationship(PongBallInstance, BorderInstance);
            PongBallInstanceVsBorderInstance.Name = "PongBallInstanceVsBorderInstance";
            PongBallInstanceVsBorderInstance.SetBounceCollision(0f, 1f, 2f);

            Player1InstanceVsPongBallInstance      = FlatRedBall.Math.Collision.CollisionManager.Self.CreateRelationship(Player1Instance, PongBallInstance);
            Player1InstanceVsPongBallInstance.Name = "Player1InstanceVsPongBallInstance";
            Player1InstanceVsPongBallInstance.SetBounceCollision(1f, 0f, 2f);

            Player1InstanceVsBorder2Instance      = FlatRedBall.Math.Collision.CollisionManager.Self.CreateRelationship(Player1Instance, Border2Instance);
            Player1InstanceVsBorder2Instance.Name = "Player1InstanceVsBorder2Instance";
            Player1InstanceVsBorder2Instance.SetMoveCollision(0f, 1f);

            Player1InstanceVsBorder3Instance      = FlatRedBall.Math.Collision.CollisionManager.Self.CreateRelationship(Player1Instance, Border3Instance);
            Player1InstanceVsBorder3Instance.Name = "Player1InstanceVsBorder3Instance";
            Player1InstanceVsBorder3Instance.SetMoveCollision(0f, 1f);

            Player2InstanceVsBorder2Instance      = FlatRedBall.Math.Collision.CollisionManager.Self.CreateRelationship(Player2Instance, Border2Instance);
            Player2InstanceVsBorder2Instance.Name = "Player2InstanceVsBorder2Instance";
            Player2InstanceVsBorder2Instance.SetMoveCollision(0f, 1f);

            Player2InstanceVsBorder3Instance      = FlatRedBall.Math.Collision.CollisionManager.Self.CreateRelationship(Player2Instance, Border3Instance);
            Player2InstanceVsBorder3Instance.Name = "Player2InstanceVsBorder3Instance";
            Player2InstanceVsBorder3Instance.SetMoveCollision(0f, 1f);

            PongBallInstanceVsPlayer2Instance      = FlatRedBall.Math.Collision.CollisionManager.Self.CreateRelationship(PongBallInstance, Player2Instance);
            PongBallInstanceVsPlayer2Instance.Name = "PongBallInstanceVsPlayer2Instance";
            PongBallInstanceVsPlayer2Instance.SetBounceCollision(0f, 1f, 2f);



            PostInitialize();
            base.Initialize(addToManagers);
            if (addToManagers)
            {
                AddToManagers();
            }
        }