Example #1
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 );
        }
Example #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 );
        }