Пример #1
0
        private void SceneInitial()
        {
            tank1 = new DuelTank("tank1", TankSinTur.M60TexPath, TankSinTur.M60Data, new Vector2(mapRect.X + 150 + RandomHelper.GetRandomFloat(-40, 40),
                                                                                                 mapRect.Y + 60 + RandomHelper.GetRandomFloat(-10, 10)),
                                 MathHelper.Pi + RandomHelper.GetRandomFloat(-MathHelper.PiOver4, MathHelper.PiOver4),
                                 "Tank1", tankRaderLength, tankMaxForwardSpd, tankMaxBackwardSpd, 10);
            tank2 = new DuelTank("tank2", TankSinTur.M1A2TexPath, TankSinTur.M1A2Data, new Vector2(mapRect.X + 150 + RandomHelper.GetRandomFloat(-40, 40),
                                                                                                   mapRect.Y + 160 + RandomHelper.GetRandomFloat(-10, 10)),
                                 RandomHelper.GetRandomFloat(-MathHelper.PiOver4, MathHelper.PiOver4),
                                 "Tank2", tankRaderLength, tankMaxForwardSpd, tankMaxBackwardSpd, 10);

            tank1.ShellSpeed = shellSpeed;
            tank2.ShellSpeed = shellSpeed;

            camera.Focus(tank1, true);

            sceneMgr.AddGroup("", new TypeGroup <DuelTank>("tank"));
            sceneMgr.AddGroup("", new TypeGroup <SmartTank.PhiCol.Border>("border"));
            sceneMgr.AddGroup("", new TypeGroup <ShellNormal>("shell"));
            sceneMgr.PhiGroups.Add("tank");
            sceneMgr.PhiGroups.Add("shell");
            sceneMgr.AddColMulGroups("tank", "border", "shell");
            sceneMgr.ShelterGroups.Add(new SceneMgr.MulPair("tank", new List <string>()));
            sceneMgr.VisionGroups.Add(new SceneMgr.MulPair("tank", new List <string>(new string[] { "tank" })));

            sceneMgr.AddGameObj("tank", tank1);
            sceneMgr.AddGameObj("tank", tank2);
            sceneMgr.AddGameObj("border", new SmartTank.PhiCol.Border(mapRect));
        }
Пример #2
0
        private void SceneInitial()
        {
            tank = new TankSinTur("tank", new GameObjInfo("Tank", "Player"), TankSinTur.M60TexPath, TankSinTur.M60Data,
                                  170, MathHelper.PiOver4, Color.Yellow,
                                  0f, 80, 60, 0.6f * MathHelper.Pi, 0.5f * MathHelper.Pi, MathHelper.Pi, 2f,
                                  new Vector2(100, 50), 0, 0);

            AutoShootAI autoShoot = new AutoShootAI();

            autoShoot.OrderServer = tank;
            ManualControl manualControl = new ManualControl();

            manualControl.OrderServer = tank;
            //tank.SetTankAI( manualControl );
            tank.SetTankAI(autoShoot);
            tank.onShoot   += new Tank.ShootEventHandler(Tank_onShoot);
            tank.ShellSpeed = shellSpeed;

            //ItemCommon item = new ItemCommon( "item", "Scorpion", Path.Combine( Directories.ContentDirectory, "GameObjs\\scorpion" ), new Vector2( 128, 128 ), 0.031f, new Vector2[] { new Vector2( 128, 128 ) },
            //    new Vector2( 150, 50 ), 0f, Vector2.Zero, 0 );
            Ball ball = new Ball("ball", 0.031f, new Vector2(150, 50), 0, Vector2.Zero, 0);

            ball.OnCollided += new OnCollidedEventHandler(item_OnCollided);

            smoke = new SmokeGenerater(0, 50, Vector2.Zero, 0.3f, 0f, true, ball);

            sceneMgr.AddGroup(string.Empty, new TypeGroup <TankSinTur>("tank"));
            sceneMgr.AddGroup(string.Empty, new TypeGroup <Ball>("ball"));
            sceneMgr.AddGroup(string.Empty, new TypeGroup <SmartTank.PhiCol.Border>("border"));
            sceneMgr.AddGroup(string.Empty, new TypeGroup <ShellNormal>("shell"));

            sceneMgr.PhiGroups.Add("tank");
            sceneMgr.PhiGroups.Add("ball");
            sceneMgr.PhiGroups.Add("shell");

            sceneMgr.ColPairGroups.Add(new SceneMgr.Pair("tank", "ball"));
            sceneMgr.ColPairGroups.Add(new SceneMgr.Pair("tank", "border"));
            sceneMgr.ColPairGroups.Add(new SceneMgr.Pair("ball", "border"));
            sceneMgr.ColPairGroups.Add(new SceneMgr.Pair("shell", "border"));
            sceneMgr.ColPairGroups.Add(new SceneMgr.Pair("shell", "ball"));

            sceneMgr.ShelterGroups.Add(new SceneMgr.MulPair("tank", new List <string>()));
            sceneMgr.VisionGroups.Add(new SceneMgr.MulPair("tank", new List <string>(new string[] { "ball" })));

            sceneMgr.AddGameObj("tank", tank);
            sceneMgr.AddGameObj("ball", ball);
            sceneMgr.AddGameObj("border", new SmartTank.PhiCol.Border(mapSize));


            //camera.Focus( tank );
        }
Пример #3
0
        private void InitializeScene()
        {
            sceneMgr = new SceneMgr();

            sceneMgr.AddGroup("", new TypeGroup <WarShip>("warship"));
            sceneMgr.AddGroup("", new TypeGroup <WarShipShell>("shell"));
            sceneMgr.AddGroup("", new TypeGroup <SmartTank.PhiCol.Border>("border"));
            sceneMgr.AddGroup("", new TypeGroup <Gold>("gold"));
            sceneMgr.AddGroup("", new TypeGroup <Rock>("rock"));

            sceneMgr.PhiGroups.Add("warship");
            sceneMgr.PhiGroups.Add("shell");
            sceneMgr.PhiGroups.Add("rock");
            sceneMgr.AddColMulGroups("warship", "shell", "border");
            sceneMgr.AddColMulGroups("warship", "shell", "rock");
            sceneMgr.ColSinGroups.Add("warship");
            sceneMgr.ColSinGroups.Add("rock");

            sceneMgr.AddLapMulGroups("warship", "gold");

            ships = new WarShip[playerNames.Length];
            for (int i = 0; i < playerNames.Length; i++)
            {
                bool openControl = false;
                if (i == controlIndex)
                {
                    openControl = true;
                }

                ships[i]            = new WarShip("ship" + i, new Vector2(400 + i * 800, 600), 0, openControl);
                ships[i].OnCollied += new OnCollidedEventHandler(WarShip_OnCollied);
                ships[i].OnOverLap += new OnCollidedEventHandler(Warship_OnOverLap);
                ships[i].OnShoot   += new WarShip.WarShipShootEventHandler(WarShip_OnShoot);
                ships[i].OnDead    += new WarShip.WarShipDeadEventHandler(Warship_OnDead);
                ships[i].PlayerName = playerNames[i];
                sceneMgr.AddGameObj("warship", ships[i]);
            }

            gold                = new Gold("gold", new Vector2(800, 600), 0);
            gold.OnOverLap     += new OnCollidedEventHandler(Gold_OnOverLap);
            gold.OnLiveTimeOut += new Gold.GoldLiveTimeOutEventHandler(Gold_OnLiveTimeOut);

            sceneMgr.AddGameObj("border", new SmartTank.PhiCol.Border(mapRect));
            sceneMgr.AddGameObj("gold", gold);

            GameManager.LoadScene(sceneMgr);

            camera.Focus(ships[controlIndex], false);
        }
Пример #4
0
        private void InitialScene()
        {
            sceneMgr = new SceneMgr();

            tank = new TankSinTur("tank", new GameObjInfo("Tank", string.Empty),
                                  TankSinTur.M60TexPath, TankSinTur.M60Data,
                                  tankRaderDepth, tankRaderAng, Color.Wheat,
                                  tankMaxForwardSpd, tankMaxBackwardSpd, tankMaxRotaSpd, tankMaxRotaTurretSpd, tankMaxRotaRaderSpd,
                                  0.3f, tankStartPos, tankStartAzi);

            wall1 = new ObstacleCommon("wall1", new GameObjInfo("wall", string.Empty), new Vector2(100, 50), 0,
                                       Path.Combine(Directories.ContentDirectory, "GameObjs\\wall"),
                                       new Vector2(90, 15), 1f, Color.White, LayerDepth.GroundObj, new Vector2[] { new Vector2(90, 15) });
            wall1.GetEyeableInfoHandler = EyeableInfo.GetEyeableInfoHandler;

            wall2 = new ObstacleCommon("wall2", new GameObjInfo("wall", string.Empty), new Vector2(250, 150), MathHelper.PiOver2,
                                       Path.Combine(Directories.ContentDirectory, "GameObjs\\wall"),
                                       new Vector2(90, 15), 1f, Color.White, LayerDepth.GroundObj, new Vector2[] { new Vector2(90, 15) });
            wall2.GetEyeableInfoHandler = EyeableInfo.GetEyeableInfoHandler;

            wall3 = new ObstacleCommon("wall3", new GameObjInfo("wall", string.Empty), new Vector2(100, 100), 0,
                                       Path.Combine(Directories.ContentDirectory, "GameObjs\\wall"),
                                       new Vector2(90, 15), 1f, Color.White, LayerDepth.GroundObj, new Vector2[] { new Vector2(90, 15) });
            wall3.GetEyeableInfoHandler = EyeableInfo.GetEyeableInfoHandler;


            ball = new Ball("ball", 0.3f, new Vector2(300, 250), 0, new Vector2(5, 5), 0);

            sceneMgr.AddGroup("", new TypeGroup <TankSinTur>("tank"));
            sceneMgr.AddGroup("", new Group("obstacle"));
            sceneMgr.AddGroup("obstacle", new TypeGroup <ObstacleCommon>("wall"));
            sceneMgr.AddGroup("obstacle", new TypeGroup <Ball>("ball"));
            sceneMgr.AddGroup("obstacle", new TypeGroup <SmartTank.PhiCol.Border>("border"));
            sceneMgr.AddColMulGroups("tank", "obstacle");
            sceneMgr.PhiGroups.AddRange(new string[] { "tank", "obstacle\\ball" });
            sceneMgr.AddShelterMulGroups("tank", "obstacle\\wall");
            sceneMgr.VisionGroups.Add(new SceneMgr.MulPair("tank", new List <string>(new string[] { "obstacle\\ball", "obstacle\\wall" })));

            sceneMgr.AddGameObj("tank", tank);
            sceneMgr.AddGameObj("obstacle\\wall", wall1, wall2, wall3);
            sceneMgr.AddGameObj("obstacle\\ball", ball);
            sceneMgr.AddGameObj("obstacle\\border", new SmartTank.PhiCol.Border(mapSize));

            GameManager.LoadScene(sceneMgr);
        }
Пример #5
0
        private void InitializeScene()
        {
            sceneMgr = new SceneMgr();

            sceneMgr.AddGroup("", new TypeGroup<WarShip>("warship"));
            sceneMgr.AddGroup("", new TypeGroup<WarShipShell>("shell"));
            sceneMgr.AddGroup("", new TypeGroup<SmartTank.PhiCol.Border>("border"));
            sceneMgr.AddGroup("", new TypeGroup<Gold>("gold"));
            sceneMgr.AddGroup("", new TypeGroup<Rock>("rock"));

            sceneMgr.PhiGroups.Add("warship");
            sceneMgr.PhiGroups.Add("shell");
            sceneMgr.PhiGroups.Add("rock");
            sceneMgr.AddColMulGroups("warship", "shell", "border");
            sceneMgr.AddColMulGroups("warship", "shell", "rock");
            sceneMgr.ColSinGroups.Add("warship");
            sceneMgr.ColSinGroups.Add("rock");

            sceneMgr.AddLapMulGroups("warship", "gold");

            ships = new WarShip[playerNames.Length];
            for (int i = 0; i < playerNames.Length; i++)
            {
                bool openControl = false;
                if (i == controlIndex)
                    openControl = true;

                ships[i] = new WarShip("ship" + i, new Vector2(400 + i * 800, 600), 0, openControl);
                ships[i].OnCollied += new OnCollidedEventHandler(WarShip_OnCollied);
                ships[i].OnOverLap += new OnCollidedEventHandler(Warship_OnOverLap);
                ships[i].OnShoot += new WarShip.WarShipShootEventHandler(WarShip_OnShoot);
                ships[i].OnDead += new WarShip.WarShipDeadEventHandler(Warship_OnDead);
                ships[i].PlayerName = playerNames[i];
                sceneMgr.AddGameObj("warship", ships[i]);
            }

            gold = new Gold("gold", new Vector2(800, 600), 0);
            gold.OnOverLap += new OnCollidedEventHandler(Gold_OnOverLap);
            gold.OnLiveTimeOut += new Gold.GoldLiveTimeOutEventHandler(Gold_OnLiveTimeOut);

            sceneMgr.AddGameObj("border", new SmartTank.PhiCol.Border(mapRect));
            sceneMgr.AddGameObj("gold", gold);

            GameManager.LoadScene(sceneMgr);

            camera.Focus(ships[controlIndex], false);
        }
Пример #6
0
        private void InitialScene()
        {
            sceneMgr = new SceneMgr();

            tank = new TankSinTur( "tank", new GameObjInfo( "Tank", string.Empty ),
                TankSinTur.M60TexPath, TankSinTur.M60Data,
                tankRaderDepth, tankRaderAng, Color.Wheat,
                tankMaxForwardSpd, tankMaxBackwardSpd, tankMaxRotaSpd, tankMaxRotaTurretSpd, tankMaxRotaRaderSpd,
                0.3f, tankStartPos, tankStartAzi );

            wall1 = new ObstacleCommon( "wall1", new GameObjInfo( "wall", string.Empty ), new Vector2( 100, 50 ), 0,
                Path.Combine( Directories.ContentDirectory, "GameObjs\\wall" ),
                new Vector2( 90, 15 ), 1f, Color.White, LayerDepth.GroundObj, new Vector2[] { new Vector2( 90, 15 ) } );
            wall1.GetEyeableInfoHandler = EyeableInfo.GetEyeableInfoHandler;

            wall2 = new ObstacleCommon( "wall2", new GameObjInfo( "wall", string.Empty ), new Vector2( 250, 150 ), MathHelper.PiOver2,
                            Path.Combine( Directories.ContentDirectory, "GameObjs\\wall" ),
                            new Vector2( 90, 15 ), 1f, Color.White, LayerDepth.GroundObj, new Vector2[] { new Vector2( 90, 15 ) } );
            wall2.GetEyeableInfoHandler = EyeableInfo.GetEyeableInfoHandler;

            wall3 = new ObstacleCommon( "wall3", new GameObjInfo( "wall", string.Empty ), new Vector2( 100, 100 ), 0,
                Path.Combine( Directories.ContentDirectory, "GameObjs\\wall" ),
                new Vector2( 90, 15 ), 1f, Color.White, LayerDepth.GroundObj, new Vector2[] { new Vector2( 90, 15 ) } );
            wall3.GetEyeableInfoHandler = EyeableInfo.GetEyeableInfoHandler;


            ball = new Ball( "ball", 0.3f, new Vector2( 300, 250 ), 0, new Vector2( 5, 5 ), 0 );

            sceneMgr.AddGroup( "", new TypeGroup<TankSinTur>( "tank" ) );
            sceneMgr.AddGroup( "", new Group( "obstacle" ) );
            sceneMgr.AddGroup( "obstacle", new TypeGroup<ObstacleCommon>( "wall" ) );
            sceneMgr.AddGroup( "obstacle", new TypeGroup<Ball>( "ball" ) );
            sceneMgr.AddGroup( "obstacle", new TypeGroup<SmartTank.PhiCol.Border>( "border" ) );
            sceneMgr.AddColMulGroups( "tank", "obstacle" );
            sceneMgr.PhiGroups.AddRange( new string[] { "tank", "obstacle\\ball" } );
            sceneMgr.AddShelterMulGroups( "tank", "obstacle\\wall" );
            sceneMgr.VisionGroups.Add( new SceneMgr.MulPair( "tank", new List<string>( new string[] { "obstacle\\ball", "obstacle\\wall" } ) ) );

            sceneMgr.AddGameObj( "tank", tank );
            sceneMgr.AddGameObj( "obstacle\\wall", wall1, wall2, wall3 );
            sceneMgr.AddGameObj( "obstacle\\ball", ball );
            sceneMgr.AddGameObj( "obstacle\\border", new SmartTank.PhiCol.Border( mapSize ) );
            
            GameManager.LoadScene( sceneMgr );
        }